Learn with tiles › 23
A catching game
Move Lara and catch the Basket.
1
Let's put together what you have learned and make one game. You move Lara with the keys and catch the Basket.
First, make Lara move. It is the same as in chapter 4. Inside "forever", ask if a key is held down.
To do While the → key is held down, move right by 5. While the ← key is held down, move left by 5.
Loading tiles…
2
The Basket already has tiles on it. When it touches Lara, it runs away to another place.
Now count the score. Each time Lara touches the Basket, raise the score, show it on the scoreboard and play a sound.
To do When touching the Basket, increase score by 1, show it on the scoreboard with the name Score, and play the coin sound.
Loading tiles…