Event explanation

This page contains a description of all the available events in Game Maker.

Create event
This event is executed immediately after the instance is created. It's where you, for example, initialize variables.

Destroy event
This is the event that occurs before your object is destroyed. Note that removing non-persistent instances from the game while ending a room doesn´t emit this event.

Alarm events
There are up to 12 such events with indices from 0 to 11. These events get called after a certain amount of time has passed.

Step events
These three events get called every step of the game. This means that if your game is running at 30 frames per second (room_speed=30) this event will be executed 30 times a second. The difference between these events is that they get called at different times.

The Begin step event gets called before anything else (collisions, keyboard events, etc.).

The normal Step event gets called after those events but before all instances are set into new positions.

The End step event is called just before the draw event.

Collision event
This event gets called when one object collides with a certain other object or hits it.

Keyboard event
Gets called every step as long as player holds down the selected key.

Key press event
Gets called the step player presses the selected key.

Key release event
Gets called the step player releases the selected key.

Mouse left/right/middle button event
Gets called every step as long as player holds down the selected mouse button on the instance.

Mouse left/right/middle button pressed event
Gets called when player clicks on the instance with the selected mouse button.

Mouse left/right/middle button released event
Gets called when player releases the selected mouse button on the instance. (This means that if player clicks on the instance, the mouse pressed event will get called, but if he then moves the mouse away from the instance and releases the mouse button, this event will NOT get called).

Mouse enter/leave event
Gets called when the mouse enters or leaves the object.

Global mouse right/left/middle button pressed/released/hold event
These events are the same as the above mouse events, but these get called even when the mouse isn't over the instance that this event belongs to.

Joystick buttons event
Gets called when player holds the selected key on a joystick down.

Outside room event
Gets called when the instance is placed completely outside the room.

Intersect boundary event
Gets called when the instance is placed partially outside the room.

Room start/end
Gets called when the room starts or ends.

Game start/end
Gets called when the game starts or ends just after Room start event of the first room.

No more lives/health
Gets called when value of variable lives or health is changed from a positive value to zero or negative one. In games that usually means lost of last life or dying of the main character.

Animation end
Gets called when the animation for the instance ends. This fact is detected while calculating new image_index of instance. It happens when image_index is changed from image_number-1 to 0 or vice versa.

End of path
Gets called when the instance reaches the end of its path (or beginning if path_speed is negative).

Draw event
Code that draws stuff onto the screen should always go here. If none action provided here, the default behavior is to draw current image of current sprite (this behavior can be changed, but should only be done by advanced users). This event gets called every step (after End Step event) and for visible instances only.