Jumping
Section 13: The pro project: a jumping gameLesson 13.2 · ⏱ 8 min
A jump = speed upwards. When you press space and Robo is on the ground, we set speed = 16, and gravity brings him back by itself. The “on the ground” condition stops him jumping in mid-air.


💡 Tip
Notice the if inside if: the second condition is checked only if the first one is true.
📌 Another example: a jump with sound and movement
When he jumps we switch his costume and play a short note, so you feel that Robo really jumped.



✍️ Practise
Make the jump higher if you press space and the up arrow together (speed 22).
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
Make the right and left arrows move Robo, even while he is in the air.
👀 Show the solution🙈 Hide the solution


Medium
Count the jumps in a variable jumps, and show it above Robo.
👀 Show the solution🙈 Hide the solution


Hard
A wall: if Robo goes past x = 100 he goes back to 100 and says “Wall! 🧱”.
👀 Show the solution🙈 Hide the solution



