GML - Adding a countdown

From Global Programming Syntax

Jump to: navigation, search

In this section you will find out how to add a countdown to your game.

Example Code

First add the following to the 'Room Start' event. To add a room start event, click on add new event, then select the 'other' event and from that list that appears select 'Room Start'. So add the following to the 'Room Start' event.

globalvar timer, timersec;
timersec=50;
timer=room_speed*timersec;

Now in the step event, add the following:

timersec-=1;
if timer=1 then
{
room_goto_next();
}
Personal tools
languages
page stats
Toolbox