{ }codelper

Learn with tiles › 24

A time limit

End the game when a set time has passed.

1

A game needs an end. Let's set a time.

Scene: time passed (s) is a value tile that tells you how many seconds have passed since the start. Scene: stop all stops every tile. The game is over.

Inside "forever", ask if the time is up.

To do If the time passed is greater than 5, say Time is up! and stop all.

Loading tiles…

2

It is even better if you can see the time left.

You can place more than one "when started" tile. They all start together. One moves Lara, and the other counts the time.

Take out the time question you made before. This time, count in the second "when started", like this.

The variable timeLeft starts at 5. Each time you wait 1 second, decrease it by 1 and show it on the scoreboard. After five times, the game is over.

To do After waiting 1 second, decrease timeLeft by 1 and show it on the scoreboard with the name Time left.

Loading tiles…

Next: Ending and restarting →