Alarm FAQ

Introduction

This is a FAQ about using alarms (and thus timers) in Game Maker 7. If you are not looking for a FAQ, but rather the specific elements that make up the alarm / timer system in Game Maker, here are a few quick links :

General

What is an alarm?

An alarm is like an egg timer, you set it and it counts down until it goes off. There are twelve alarms for each object, numbered to 11.

What does an alarm count?

Unlike and egg timer, which counts down in seconds, a Game Maker alarm counts down in steps. To give you an idea, your current room_speed is in ''steps per second''. Therefore it counts room_speed in steps per second.

How do I set an alarm?

There are two ways to set an alarm, through a drag and drop action or through GML.

To set an alarm using GML, simply use this code, where x equals the timer you want to set ( to 11) and steps equals the number of steps you want it to count down.

alarm[0] = steps;

How do I set an alarm in seconds?

Your room_speed is set in ''steps per second''. All you have to do is multiply the number of seconds by room_speed.

alarm[0] = room_speed * 10; //ten seconds

What does alarm[0] mean?

Information needed.

Needed : How to set an alarm using an action.

What happens when an alarm goes off?

The Alarm event associated with that timer is triggered and any actions or code in that alarm event are executed.

How do I make an alarm that goes off repeatedly?

Usually, when you set an alarm, it only goes off once. To make an alarm go off repeatedly, you need to set it again when its associated alarm event is triggered.

Applications

How do I make a countdown timer?

An answer is needed here.

How do I make a level timer?

An answer is needed here.

How do I make an artificial time system?

An answer is needed here.

How do I make regenerating health?

Make a repeating alarm as above and then add a small bit of health each time the alarm event goes off.