Using Colors To Sense Direction
Weāve using the Sensing blocks to detect if we should stop falling, but this doesnāt work super well with a platformer because we donāt want our player to stop falling because their head is touching the platform. (Or, maybe you do. I donāt know.)
In Scratch, we donāt have a ton of options, but there is a little trick that we can use: the ability to see if a certain color on the sprite is touching another color.
If weāre super careful about our color choices, we can get the mechanic that weāre looking for.
if <color (#F00) is touching (#00F)?> then
set [y velocity v] to [0]
end
If weāre clever, we can also use colors to detect if we touching a wall as well. But, Iāll leave that as an exercise for you.