Welcome to a fun challenge add-on called Fitness Coach! The challenge is to code the spriteto appear to have a pulse and talk about how the fitness gadget tracks its heart rate!
This video will help you plan how to code the sprite, then you’ll try it on your own.
One way to make the sprite look like it has a heart rate is to apply the “fisheye”effect to it. To do that, from the “looks” menu, add a “change effect” block. Ifyou change the dropdown to “fisheye” and click the block, the sprite will have a funnyfisheye effect. To reverse the effect, add another “change effect” block with theopposite number in the value space – meaning add a negative sign. To make it look morelike a pulse, keep repeating the increase and decrease. You may also want to add “wait”blocks from the “control” menu to change the pace of the pulse.
Add some “say” blocks to describe how your fitness gadget tracks a user’s heartrate. In this example, the sprite introduces the heart rate feature, shows off the heartbeateffect, then states its heart rate. Tinker with the values in each block to customizeyour program. When you are finished, tell your program whento make this code run. Using “broadcast” and “receive” blocks will help make iteasier to read and reuse code.
From the “events” menu, drag a “broadcast and wait” block to at least one place onthe block stack from the starter code. Put it in each spot where you want the spriteto appear to have a pulse and talk about heart rate. From the dropdown, select “new message,”type “fitness coach,” and click OK! “Broadcast and wait” tells the program to wait untilthe code that receives the message is done running before the program runs more code.
“Broadcast” would let the rest of the code happen while the sprite is pulsating.
Finally, from the “events” menu, place a “when I receive” block on top of thecode giving the sprite a pulse. From the dropdown, select “fitness coach.”
Test the code by clicking the flag. The sprite should look like it has a pulse and commenton it when the program reaches the “fitness coach” broadcast block.
Here’s the game plan: Code the Fitness Coach add-on by describing your gadget’s heartrate feature and demonstrating how it tracks a user’s heart rate. To make this work,add “broadcast” and “when I receive” blocks to your code. Test your code oftenuntil you like the way it works. Have fun coding your program.
Danza della felicità
Fai ballare lo sprite.
Cambio di scena
Sposta l'Android da un paesaggio all'altro per vedere come reagisce il gadget.
Aggiungi effetti climatici per dimostrare quanto è resistente il gadget.
Decidi se comprare
Chiedi allo spettatore di comprare l'oggetto.
Aggiungi al progetto altri sprite e falli interagire con l'atleta.
Il preparatore atletico
Ordina allo sprite di mostrare il battito e di parlare della sua frequenza cardiaca.