Please update your browser
Your browser version is not supported by this site. CS First may not work properly.
In this video, you'll fix a bug
to make the sprite land on its feet.
Currently, the sprite stays on the platform,
even if its feet are not touching it.
This is because of how it's programmed.
The if statement that moves the sprite down reads,
"If touching sprite."
It doesn't make sense for the sprite to stay on the platform
if another body part, like it's head is touching it.
In this add-on, you'll change the code
so the sprite stays on the platform only
when its feet are touching it.
The best way to check if a part of one sprite
is touching another sprite is to use a color.
To do this, give the sprite's feet a unique color.
This example changes the color to green,
but you can make the bottom of the sprite
any color you want.
Depending on what your sprite looks like,
and how it's shaped, you may need to get creative
with the pen or line tool to give the bottom
of the sprite a unique color.
Now, instead of saying, if not touching the color black,
move down, say, if the color green,
which is the color of the sprite's shoes,
is not touching the color black, then move down.
Change the color swatch in the touching color block.
Test your code.
Awesome, if the sprite is touching the platform
with anything but its shoes, it keeps falling.
But, if the green shoes are touching the platform,
the sprite doesn't fall.
Now it's your turn.
Change the color of the bottom of the sprite.
Program in the sprite to stop falling
only if its feet are touching the black platform.