Event

An Event in Game Maker is one of the top four Game Maker concepts. An event is the occasion where an object would perform a set of actions. Otherwise, the Object wouldn't know when show these actions be performed.

Create Event
The create event is the event where its actions are called at the moment the object is created (created in the room). This means that it interrupts the current event. So if you create an instance of an object and then set a variable in that object immediately after that (in the same event), the create event for that instance is already executed.

Destroy Event
The destroy event is the event where its actions are called at the moment where the object is destroyed (removed from the room).

Alarm Event
The alarm event is executed when the corresponding global alarm variable reaches 0 (for instance, if alarm[1] is set to 5 in the create event the alarm 1 event will trigger 5 steps later).

Step Event
The step event is executed every step. A step event in Game Maker consists of three sub-events:
 * Begin Step: The begin step is executed every step, like all step events, but it is executed before them, the begin step is executed before any event in this step occurs.
 * Normal Step: The step event is executed just before instances are put in their new positions.
 * End Step: End step is executed after all events are executed in this step (with the exception of the draw event).

Collision Event
In the collision event, actions are performed when an object collides with a certain object. When clicking on the "Collision Event" button, you will see a menu containing the names of all the objects. You select an object, and it will be the collision event with that object. Don't understand? Here is an example:object1 is the bullet and object2 is the enemy. In object2's code, it must be destroyed when it collides with object1. Inside the object properties of object2 (the enemy) click on the collision event button and you will see a list of all the objects, select object1 (the bullet), this means that object2 will perform the list of actions when object1 collides with it. Next you can put the required action inside the box on the left.

Keyboard Event
The keyboard event is executed whenever a key is pressed. A key can be a letter, a function key, a number, a direction, or any key located in the keyboard. If you hold a key down, the event will keep executing untill the key is released.

Key press Event
The key press event is executed only when the key is first pressed. That means that it is executed once every time the key is pressed.

Key release Event
The key release event is executed only when the given key is released. That means that it is executed once when the key is released.

Mouse Button Event
Mouse events have three types: Note: mouse button events occur only when the mouse is over the sprite associated with the object.
 * 1) . Mouse button: Called whenever a mouse button is pressed and is hovering the object, just like the keyboard event.
 * 2) . Mouse press: Called only once when the button is first clicked, in order to be called again, the mouse must be released and pressed again.
 * 3) . Mouse release: Called only once the mouse is released.

Mouse Enter and Leave Events
Mouse enter and leave events are called once the mouse enters or leaves the object. I.e., when the mouse hovers the sprite associated with the objects or stops hovering it.

Mouse Wheel Events (Up and Down)
The mouse wheel events are executed when the mouse wheel is scrolled up or down.

Global Mouse Events
Global mouse includes many sub-events which are almost identical to the Mouse button events, except that they are executed regardless of the mouses location.

Other Events
The other event has many sub-events in it:
 * Outside Room: Whenever the object is outside the room
 * Intersect Boundary: Whenever the object touches the boundary of the room.
 * Game Start: Whenever the game starts.
 * Game End: Whenever the game ends.
 * Room Start: Whenever the room starts.
 * Room End: Whenever the room ends.
 * No More Lives: When the player has no more lives.
 * No More Health: When the player has no more health.
 * Animation End: Whenever the sprite associated to the object is done animating.
 * End of path: When the object is done of performing its path.
 * User defined: User defined

Creating an event
To create an event click "Add Event" in the bottom-center of the object screen. You may then Choose an event type and a specific event.