๐ ๏ธ Section project: control Robo
Section 4: EventsLesson 4.3 ยท โฑ 12 min
Make a character you control with the keyboard, like the start of any game.
๐ฏ Project goal
The four arrows move Robo in every direction, the space key makes him jump, and clicking him makes him say Hi!
Steps
- Make a flag script that puts Robo in the middle.
- Make 4 scripts for the arrows: change x or change y by 10 or -10.
- Make the space script: change y by 50, then a short wait, then change y by -50.
- Make the script for clicking the character.



๐ Note
Here every script starts with a different event, and they all work on the same character.
๐ Another example: Robo walks facing his way
Every arrow points Robo the way he moves, and switches his costume so he seems to walk.




โ๏ธ Practise
Build the whole control project here: the four arrows and the jump.
โ๏ธ Practise here in the lessonโ Close the labor open the lab in a new page โ
๐ฏ Challenge yourself
Easy
Add the key 1 to bring Robo back to the middle (0, 0).
๐ Show the solution๐ Hide the solution




Medium
Make the space jump higher (80), and switch the costume at the start of the jump.
๐ Show the solution๐ Hide the solution


Hard
Diagonal moves: the key d goes up-right, and the key a goes up-left (x and y together).
๐ Show the solution๐ Hide the solution





