Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

Transcript

Welcome to a fun challenge add-on called Fitness Coach! The challenge is to code the sprite to 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. If you change the dropdown to “fisheye” and click the block, the sprite will have a funny fisheye effect. To reverse the effect, add another “change effect” block with the opposite number in the value space – meaning add a negative sign. To make it look more like 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 heart rate. In this example, the sprite introduces the heart rate feature, shows off the heartbeat effect, then states its heart rate. Tinker with the values in each block to customize your program. When you are finished, tell your program when to make this code run. Using “broadcast” and “receive” blocks will help make it easier to read and reuse code.

From the “events” menu, drag a “broadcast and wait” block to at least one place on the block stack from the starter code. Put it in each spot where you want the sprite to 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 until the 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 the code 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 comment on 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 heart rate 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 often until you like the way it works. Have fun coding your program.

Choose an Add-On
Happy Dance
Program the sprite to dance.
Changing Scene
Move the android through different scenes to see how the gadget reacts.
Weatherproof
Add weather effects to show how rugged the gadget is.
Purchase Decision
Ask the buyer to purchase the object.
Admiring Crowd
Add more sprites to the project to interact with the athlete.
Fitness Coach
Code the sprite to have a pulse and talk about its heart rate.
arrow_backward Back
Next arrow_forward
Instructions
  1. Choose an Add-On, and click "watch" to learn how to build it.
  2. Once you finish one Add-On, try another one below the video!