Jan 09, 2019 The alarm system is use to activate (begin) a program (set/lines) of code(s) when that alarm = 0. What I do is inside a create event (on the object that will use the alarm), I set the alarm by doing the following: CREATE EVENT: alarm0 = roomspeed. 1; ///What that does is make the - alarm0 - active in one second. If you wanted 5 seconds.
Events in GameMaker: Studio are things you add to your game to control the action the player has. Here are nine types of events you can use in games that you make in GameMaker: Studio.
The destroy event
Use the Destroy Event when you no longer want an Instance in the Room — say, when an enemy gets blown up. You can use the Destroy Event to trigger an explosion, increase the player’s score, or re-create a new Instance of the Object (or all three).
This figure shows an Object with a Destroy Event with a Set Score Action. This obviously isn’t a fully configured enemy Object — you would want the Destroy Event to be the last, and certainly not the only, Event.
Use the Destroy Event to increase the player’s score.
The alarm event
You can add up to 12 Alarms for each Instance in the Room. Alarms are excellent for when you want to time Actions. For example, if you want the player to only shoot bullets once every two seconds, you can set an Alarm for that. If you want to time when new enemy planes appear, you can set an Alarm for that as well.
To get an Alarm to work, you must first set an Alarm Action to trigger the Alarm Event after a countdown that you set. In that way, Alarms enable you to time when events happen in your game.
An Instance is an Object that you’ve placed in the Room. You can place more than one Instance of an Object in a Room, so you can have multiple Instances of the same Object in your game.
The step event
Step Events are great for when you want something to continuously happen, or you want something continuously checked for each step of the game. GameMaker tells time by steps, which is defined by the Room Speed, which sets how many steps are performed each second.
An example of using a Step Event is to determine if certain Instances have left the Room, and if so, to reappear at the top of the Room. As GameMaker needs to continuously check to see if the Instance left the Room, a Step Event comes in very handy to use.
The collision event
If your game has Instances flying every which way and collisions are inevitable, then you may be using a lot of Collision Events. These Events are great for when you want something to happen when two Instances collide — such as when a bullet Instance hits a plane Instance or, more simply, when a player Instance hits a wall Instance and you want the player to bounce off the wall.
Masks are important to Collision Events because this is how GameMaker determines where the actual collision takes place.
The mouse event
Mouse Events can be as simple as assigning the left button to fire, but there is a large submenu of Events that you can choose from. This figure also shows the tertiary menu for Global mouse.
In this way, GameMaker provides you great control over how you want the mouse to behave in your game. After you choose which Mouse Event you want to use, you can add Actions to that event or even your own code.
The other event
Ah, the Others. Those not deemed worthy of their own place on the Event menu. These Other Events can be kinda awesome. The menu items are pretty much self-explanatory, so details on them are not needed here. For full descriptions of each of these items, you can always press F1 within the GameMaker and search for Events.
The draw event
Use the Draw Event when you want to display something during the game. The Draw Event does have its own submenu, as shown in this figure.
If you use a Draw Event, GameMaker no longer defaults to the assigned Sprite, and instead you have to tell GameMaker what to draw.
The key events
When you click Add Event, you may notice there are three different options for the keyboard: Keyboard, Key Press, and Key Release. Use the Key Press and Key Release Events to trigger an Action once each time an assigned key is pressed or released. The Keyboard Event is good for when the player needs to press the key continuously, such as for moving an Instance across the Room.
Each of the Key Events has a submenu, as shown in the figure, from which you can assign a key for the Action. Use <Left>, <Right>, and so on for the arrow keys on the keyboard.
The Keyboard has many options to fit your many needs.
The asynchronous event
The Asynchronous Event is triggered at the end of another Action, such as the loading of a file or a reply from a web server. This Event also has a submenu, as shown here.
The Asynchronous Event triggers after another Action finishes.
Asynchronous Events are triggered by functions that need to receive data from a source at an unknown time in the future. This Event is best used for seasoned game developers who are creating complex online games.
Related articles:
Load more
Alarms are excellent for when you want to time Actions in your game in GameMaker: Studio. For example, if you want the player to only shoot bullets once every two seconds, you can set an Alarm for that. If you want to time when new enemy planes appear, you can set an Alarm for that as well.
You can add up to 12 Alarms for each Instance in the Room. To get an Alarm to work, you must first set an Alarm Action to trigger the Alarm Event after a countdown that you set. In that way, Alarms enable you to time when events happen in your game.
Timelines are another great way to time events in your game.
When you choose the Alarm Event from the Event menu, a new submenu opens. From that submenu, you can choose the Alarm you want to configure and add Actions to (see this figure).
An Instance is an Object that you’ve placed in the Room. You can place more than one Instance of an Object in a Room, so you can have multiple Instances of the same Object in your game.