Home | Customize | Blog | Extras | Log In | Info
Manual | D&D icons | GML Parser | Archive | Iso City
Username: Password:  
About | Features | Directory | Banners | Contact

Designing Games with GameMaker
Designing Games with GameMaker


Good games require careful timing of things happening. Fortunately GameMaker does most of the timing for you. It makes sure things happen at a constant rate. This rate is defined when defining the rooms. But you can change it using the global variable room_speed. So for example, you can slowly increase the speed of the game, making it more difficult, by adding a very small amount (like 0.001) to room_speed in every step. If your machine is slow the game speed might not be achieved. This can be checked using the variable fps that constantly monitors the actual number of frames per second. Finally, for some advanced timing you can use the variable current_time that gives the number of milliseconds since the computer was started. Here is the total collection of variables available (only the first one can be changed):

room_speed Speed of the game in the current room (in steps per second).
fps* Number of frames that are actually drawn per second.
current_time* Number of milliseconds that have passed since the system was started.
current_year* The current year.
current_month* The current month.
current_day* The current day.
current_weekday* The current day of the week (1=sunday, ..., 7=saturday).
current_hour* The current hour.
current_minute* The current minute.
current_second* The current second.

Sometimes you might want to stop the game for a short while. For this, use the sleep function.

sleep(numb) Sleeps numb milliseconds.

As you should know, every instance has 12 different alarm clocks that you can set. To change the values (or get the values) of the different alarm clocks use the following variable:

alarm[0..11] Value of the indicated alarm clock. (Note that alarm clocks only get updated when the alarm event for the object contains actions!)

We have seen that for complex timing issues you can use the time line resource. Each instance can have a time line resource associated with it. The following variables deal with this:

timeline_index Index of the time line associated with the instance. You can set this to a particular time line to use that one. Set it to -1 to stop using a time line for the instance. Note that this does not start the time line. For this use the variable timeline_running.
timeline_position Current position within the time line. You can change this to skip certain parts or to repeat parts.
timeline_speed Normally, in each step the position in the time line is increased by 1. You can change this amount by setting this variable to a different value. You can use real numbers like 0.5. If the value is larger than one, several moments can happen within the same time step. They will all be performed in the correct order, so no actions will be skipped. You can also use a negative value to let the time line play backwards.
timeline_running Indicates whether the time line is running (true) or paused or stopped (false). You can change this variable to run or stop the time line.
timeline_looping Indicated whether the time line is looping (true) or not (false). You can change this variable to switch looping on or off.

Search Search

Alternative versions Alternative versions

You can also read this manual on one single long page (± 1.5 mb)

Also available in: Dutch French German

ZIP Download helpfile

Advertisement Advertisement

GameMaker Manual