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 fish-eye effect to it.

To do that, from the looks menu, add a change-effect block.

If you change the drop-down to fish-eye and click the block, the sprite will leave a funny fish-eye 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 a pulse.

Add some say blocks to describe how your fitness gadget tracks a users heart rate.

In this example, the sprite introduces the heart rate feature, shows off the heart beat 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 re-use 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 drop-down, select new message, type Fitness Coach and click OK.

Broadcast and wait tells a program to wait until the code that receives the message is done running before the program runs more code.

Broadcasts will 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 drop-down, 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.

(techno music)

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 users heart rate.

To make this work, add broadcasts 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
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.
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!