arrow_back Bug Fix: Land on Your Feet...or Not
Currently, the sprite will stay on the platform no matter what body part is 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 its head, is touching it. In this step, you’ll change the program so the sprite only stays on the platform when its feet are touching it.
The best way to check if part of a sprite is touching another sprite is to use a color.
To do this, you’ll need to give the sprite’s feet a unique color.
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,” instead, put a "color is touching" block from the Sensing menu.
Now, it should say "if the color green" (which is the color of this sprite’s shoes) is not touching the color black, then move down.”
Once you’ve programmed this, try it to see if it works!
If the sprite is touching the platform with anything but its shoes, it keeps falling.
If the green shoes are touching the platform, this sprite doesn’t fall.Perfect!