Trigger Logic
This activity is included in an 8-part, 1 hour series to learn Game Maker. Short, focused topics with guided practice will give you practical experience building useful logic for creating games.
Begin Game Maker 5
Trigger Logic with Messages
🟡 MEDIUM
In this activity, you will learn how to set up behaviors and components to create simple logic systems with objects as you explore the basics of communications in Game Maker using messages to create cause and effect.
Launch Game Maker
Open or create an Experience and move to an area with empty space.
Let's turn the grid off and focus on logic.
Some behaviors and components are only available as [MP], which means they are multiplayer synchronized. For this activity, choose [MP] only when a [SP] option isn't available.
Designing gameplay with [SP] and [MP] logic will be explored later.
Collisions & Messages
Add the following objects to the viewport:
Asset: Door (any) No behavior
Asset: Door (any) Door behaviour
Test (Press TAB)
TAB)Press
Eto interact with each door. One door is only a prop. The other animates to appear open and turns off its collisions so players can pass through.
Toggle Behaviours On/Off
Add an object that sends a message:
Asset: Museum Info Panel
Button component
Message to Send:
Door.UnlockedBroadcast Type: EveryoneInRange
Create a custom message by typing it into the message field and click to Add it.
Add two objects in range (the yellow sphere) of the first object to receive the message:
Asset: Door (any)
Door behavior
Message to Open:
Door.Unlocked
Select the existing message from the message dropdown list.
Asset: Door (any)
Door behavior
Message to Open:
Interact
Toggle component
Turn On Message:
Door.UnlockedInitial Behaviour State: False (behavior inactive at game start)
Test (Press TAB)
TAB)Neither door can be opened. Interact with the panel to send its message, and then:
One door opens
The other door's behaviour is toggled on so players can open the door with
E.
Trigger & Filter Messages
Add the following objects to the viewport:
TRIGGER: AVATAR DETECTED
Message sent to everything in the Experience (location doesn't matter)
Asset: Door (any) Name: DoorA
Door behaviour
Message to Open:
DoorA.Open
Asset: Ancient Lever
Message Broadcaster behaviour
Message to Send:
DoorA.OpenBroadcast Type: All
Wait Before Broadcast: True
Message Required: Interact
TRIGGER: OBJECT COLLECTED
Message sent to specific objects
Asset: Door (any) Name: DoorB
Door behavior
Message to Open:
DoorB.Open
Asset: Key (any)
Collectable component
Message On Collect:
DoorB.OpenBroadcast Type: SelectedActors
Broadcast Targets: DoorB
Alternative Method: Add a tag to the door, set the key to broadcast the message to SpecificTagsInRange, and adjust the key's broadcast range to include the door's location.
TRIGGER: TAG DETECTED
Message sent to self
(when the object detects a specific tag in range)
Asset: Door (any) Name: DoorC
Door behavior
Message to Open:
DoorC.Open
Speaker component
Detection Type: SpecificTagsinRange
Include Tags:
DoorC.KeyMessage to Send:
DoorC.OpenBroadcast Type: Self
Asset: Key (any)
Tag: DoorC.Key
Pickable component
Test (Press TAB)
TAB)Trigger doors A, B, and C to open based on the logic set up. Imagine ways to use these simple trigger methods for other design needs!
One Message to Trigger Multiple Objects
Add the following objects to the viewport:
TRIGGER: AVATAR DETECTED INSIDE A VOLUME
Asset: Logic Asset
Trigger Volume component
Detection Type: EveryAvatarInRange
Detection Shape: Box
Detection Area: x
15y5z15Enter Message:
NightExit Message:
DayBroadcast Type: All
Asset: Car (any)
Basic Platform behaviour
Move Offset: x
0y0z5Look at Destination: True
Toggle component
Turn On Message:
NightInitial Behaviour State: False (behavior inactive at game start)
Asset: Weather Asset Name: Night
Message Required:
NightProfile: Night
Asset: Luxury Street Light
(prop with no logic)
Asset: Logic Light Asset Name: Street Light Position: Luxury Street Light (point down)
Light Type: Spot Light
Starting State: Off
Spot Angle: 15
Message Turn ON:
NightMessage Turn OFF:
Day
(2x) Asset: Logic Light Asset Name: Headlight Position: Car headlights (point forward)
Light Type: Spot Light
Starting State: Off
Spot Angle: 15
Message Turn ON:
NightMessage Turn OFF:
Day
Test (Press TAB)
TAB)The lights do not move with the car. Let's create a relationship in the hierarchy to fix that.
Modify
Set the "Headlight" assets to move with the car's platform motion. Open the hierarchy, select them, and drag them onto the Car. This makes them child objects and the car the parent object.
Test (Press TAB)
TAB)The location of the "Headlight" assets is now controlled by their parent object's motion.
Messages with Arguments
Continue with the previous example so weather and the streetlight will gradually change.
Add objects to communicate special messages:
Asset: Logic Asset Name: Street Light Trigger
Message Broadcaster behaviour
Message to Send:
LightColorTime: 10
Wait Before Broadcast: True
Message Required:
Night
Asset: Logic Asset Name: Weather Trigger
Message Broadcaster behaviour
Message to Send:
WeatherFadeTime: 10
Wait Before Broadcast: True
Message Required:
Night
Modify existing objects to receive the special messages:
Asset: Logic Light Asset Name: Street Light
Message Turn ON:NightMessage Turn ON:
LightColor
Asset: Weather Asset Name: Night
Message Required:NightMessage Required:
WeatherFade
Test (Press TAB)
TAB)The weather and streetlight gradually change using these special messages.
Save your Experience so this logic is available for use in another activity.
Follow Up
This activity introduced new tools and concepts to understand objects more and how to make them communicate in custom ways.
In the next activity, you will learn to integrate quests with some of the logic from this activity so you can begin designing a flow for players with clear guidance to play through your Experience.
Ready for More Practice?
This activity leaves room for you to test out your own ideas when the player exits the Trigger Volume and the message Day is sent. Test out custom weather profiles and light colours, too!
Remember that the special message
LightColorsets transition timing and colour.
➕ Relevant Resources
Triggering logic is a deep, complex topic. The resources below are beginner friendly so you won't feel overwhelmed. We'll add more to later Begin Game Maker resource sections when topics are covered.

Learn about triggering common game events and get a clear big picture view of logic use in Game Maker
Forum: Community Ideas & Support
Other "Begin Game Maker" Videos
Last updated
Was this helpful?



