Countdown Timer
Before you start, you will need either a Maze or Platform game with at least
one level.
Download the Basic Movement engine here
Download the the Basic Platform engine here
To make a countdown on a level, you have to use Timer Actions and Events in game maker. Timer actions are basically like an egg timer in real life, you set how long the timer goes on for and there is an Event when the time is up.
In game maker you can set upto 12 Alarams on one object.
Making the Timer Object
First, you need to make a new object, it won't need a sprite, call it, o_timer
Setting the Time Limit
The first thing we have to do is make a variable to remember how many seconds are left on the clock.
Add a Create Event to the timer object.![]()
On the Create Event, from the Control tab, add the, Set Variable Action ![]()

Set the variable as, time_left
Set the value as, 60
This will make us a new variable that will remember how many seconds is left before the time is up.
Ticking away at the Time
Now, to tick the time away, we want to take 1 away from the time_left variable very second. We can do this with a Timer Action, if we set the timer for one second, on the Timer Event, we can reduce the time_left variable.
Time in game maker is mesaured in steps, there are 30 steps per second.
First we have to set the timer,
From the Main2 tab, add the, Set an Alarm Clock Action ![]()
The settings will appear,

Rember that there are 30 steps in a second, we want this alarm to happen every second so..
Set number of steps as, 30
set, in alarm no, as 0
You can have up to 12 alarms, we will use the first alarm which is 0, now, in order to do something when alarm 0 rings, we have to put the Actions in an Alarm Event for alarm 0.
Add a new Alarm Event and from the drop down list, choose, Alarm 0 ![]()
The first thing we want to do when the second is up is take 1 away from the time_left variable.
From the Control tab, add the , Set Variable Action ![]()
Set variable as, time_left
Set value as, -1 relative
This will take 1 away from the time_left
Checking if Time is Up
After we take a second away, we should really set the alarm again for another second but ONLY if there are still some seconds left, if not, we should do the time up actions, these will depend on what you want your game to do when the time runs out.
We will check if the time_left variable's value is zero, if it is, we will do something to end the level, if not, then we will reset the alarm for another second.
Still in the Alarm 0 event,
From the Control Tab, Add the, Check IF Variable
has a Value Action ![]()

Set variable as, lime_left
Set value as, 0
Set operation as, equal to
This will check if the time_left variable's value is equal to 0. An IF question normally only does the next action block the question is true, if it's not, it skips to the block after.
If we want to do more than one Action if the question is true, we need to use Start and End Blocks.
From the Control Tab, Add the Start and End Blocks one after the other. ![]()
![]()
After the Action that happens when a question is true, you can use an Else Statement to do something if the awnser is false and only if the awnser is false. We will use an else statement and if the awnser to our question is false, we will reset the second timer.
From the Control Tab, Add the Else Block ![]()
From the Main2 tab, add the, Set an Alarm Clock Action ![]()
Set number of steps as, 30
set, in alarm no, as 0
Now, we have a timer that will tick down, it's up to you to put Actions between the Start and End blocks, these actions will happen when the time is up. In the following example, I used the Show Message Action to display a message, download the example to see this in action.
The message will ONLY show if time_left is equal to 0, otherwise, the Else action, Reset Alarm, will happen.
Displaying the Countdown Timer
At the moment, the timer is fully functional, it works, wait for 60 seconds and it will perform your event but as it is, this isn't good for the game because the player can't see the time. We want to draw the timer onto to screen so the player knows exactly how much time they have left.
Add the Draw Event to the timer object. This is event is used to draw onto
the screen. ![]()
Draw Actions will ONLY work in a Draw Event.
On the Draw Event, from the Control tab, use the, Draw Value of a Variable
Action ![]()
On the settings menu you have to choose what variable to draw and where.

Set variable as, time_left
Set x and y values for where you wan't the timer to display.
In this example I have put 10x and 10y, this will draw it at the top left of the level.
If you are using a camera, please read this tutorial or your timer won't show where you want it too when you scroll the level.
Download working example