Your character can move and jump now, so it’s time to add some balls that the character has to avoid.
Create a new ball sprite. You can choose any type of ball you like.
Resize the ball sprite so that the character can jump over it. Try making the character jump over the ball to test whether the ball is the right size.
Add this code to your ball sprite:
This code creates a new clone of the ball sprite every three seconds. Each new clone moves along the top platform and then drops.
Click the flag to test the game.
Add more code to your ball sprite so that clones of it move across all three platforms.
Now add some code blocks to broadcast (send) a message if your character gets hit by a ball!
Add this code to your ball sprite:
Finally, add code blocks to your character sprite to make it move back to its starting position when it receives the hit
message:
Test out your code. Check whether the character moves back to the start after touching a ball.