Displaying a countdown timer on the screen
In Chapter 4, Creating Behaviors, we created a new scene behavior called Score Management
, which contains the Decrement Countdown event, shown as follows:
Currently, as we can see in the previous screenshot, this event decrements the Countdown
attribute by a value of 1
, every second.
We also have a debug print
instruction that displays the current value of Countdown
in the debug console to help us, as game developers, keep track of the countdown. However, players of the game cannot see the debug console, so we need to provide an alternative means of displaying the amount of time that the player has to complete the level.
Let's see how we can display that information on the screen for players of our game.