video demo of interactions
https://youtu.be/ABYUFV8TOhE?si=V_bw1kZ50qy2n0RI
live demo (class)
https://youtu.be/ZxLsmtZn3gI?si=Th3ScGrTBBLxumQg
p5.js and micro:bit code
<aside> 🔴 p5.js click preview to full screen
</aside>
<aside> ⚫ Actions and basic logic ’a’ - tilt to appease at hunger = 0 ’s’ - shake to poop at hunger =10 ’f’ - to feed ’1’ - to sleep during ‘normal | happy only’ ’2’ - to wakeup during ‘nightmare only’
</aside>
https://editor.p5js.org/annabellephua/sketches/Wu-cu41WH
<aside> 🔴 Microbit
</aside>
https://makecode.microbit.org/S42257-64477-70929-80373
State Transition Diagram
state | key | action | condition | |
---|---|---|---|---|
maxAngry |
a |
appease | tilt ← and → | |
with microbit facing you | when hunger = 0 | |||
angry normal happy |
f |
feed | magnet | |
near microbit, but not hovering over on top | when hunger is 0 < x 10 | |||
maxFeed |
s |
shake | shake ← and → | when hunger = 10 |
sleeping |
1 |
sleep | cover light source | when hunger 5 < x < 10 |
nightmare |
2 |
wakeup | shout | light source + loud noise |