arrow_back Keeping Time (Part 1 of 2)
In this add-on, you’ll add a timer to keep score for this game.
To start, click on the player sprite. Then, go to sensing to drag out the “timer” variable. Variables in computer science hold values. The timer variable will keep track of how much time it takes to complete the game.
Click the checkbox next to the timer, and its value will appear in the upper left corner of the stage. When the flag is clicked, the timer is set to 0 and begins to run.
Use a "say" block with the timer variable to make the player sprite say the user’s time when it touches the goal sprite. Remember, variables hold values, so rather than saying “timer,” the player will say the value of the timer, like 10 seconds.
Click the flag to test. Ahhhh! Great. Check out that time.
Now, it’s your turn: Keep track of the player’s time using “timer,” and “say” blocks.