Introduction
In this chapter, we are going to implement different kinds of timers and countdowns. These serve many different purposes in games, such as indicating to the player how much time he has left to complete a level or after how long he will be able to use a certain ability again. Timers are also a good way for players to experience flow throughout the game. On the other hand, countdowns can indicate how much time is remaining to complete a task, depending on the aspect of gameplay that we are trying to represent with a timer — for example, to let a player know how much time is remaining to complete a task, or how much time has elapsed since the task began. Both timers and countdowns are effective methods of altering the dynamics of gameplay.
We will begin this chapter by seeing how to create a numeric timer. From this, you will learn how to create graphic timers and, finally, how to implement a countdown that changes over time.