Keyboard keys
Section 4: EventsLesson 4.2 · ⏱ 7 min
The block when key pressed runs the blocks under it when a certain key is pressed. With four scripts for the four arrows you control the character like in games.


🖥️ What happens on the stage?
When you press the right arrow Robo moves right, and when you press the left arrow he moves left.
📌 Another example: a car that turns
The right and left arrows turn Robo 15 degrees, and the up arrow moves him forward in his direction.





✍️ Practise
Finish the other two arrows (up arrow and down arrow) using change y.
✍️ Practise here in the lesson✖ Close the labor open the lab in a new page ↗
🎯 Challenge yourself
Easy
The space key makes Robo say “Jump!” and jump up 40, then come down.
👀 Show the solution🙈 Hide the solution


Medium
The key a makes Robo 10 bigger, and the key d makes him 10 smaller. We pressed a three times, then d: what is the size?
👀 Show the solution🙈 Hide the solution




Hard
The four arrows: each arrow points Robo its way (point in direction), then moves him 10.
👀 Show the solution🙈 Hide the solution







