Switch to Book Layout1: Getting Started2: Building Logic
3: Actors
4: Scenes
5: Game Mechanics6: Advanced Topics7: Testing & Tuning8: The Last 10%M1: Mobile - IntroM2: Mobile - BasicsM3: Mobile - ServicesM4: Mobile - PublishingA: Troubleshooting
B: How-To Guides
C: ReferenceD: Resources3.0 Drafts (In Progress)
|
||
|
Level: Intermediate
Custom Events
Note: In past versions, Custom Events were known as "Messaging." We changed the name to make its intent clearer and easier to undestand. Functionality-wise, nothing has changed.
Contents
What are Custom Events?Custom Events are special kinds of events that happen only when you tell them to happen. Why would you want to do this?
Aside: In programming terms, Custom Events are equivalent to the concept of "messaging" or "indirect invocation" - they aren't quite the same as function calls since you aren't always specifying a receiver. There can be as few as 0 receivers or infinitely many.
Defining Custom Events1) Inside the Behavior Designer, go to Add Event > Advanced > Custom Event
2) Type something into the blank. This is the text that will cause this Custom Event to trigger.
That's it! Now fill out what you want to happen inside the event.
Triggering Custom EventsCustom Events are triggered by any one of the blocks under Behavior > Triggers. The act of telling a Custom Event to happen is called triggering. To trigger an event, put in the text you stuck into the blank when defining the event.
That's all there is to triggering Custom Events. You might be curious about what the difference is between the "all behaviors" vs. "(one) behavior" variants though...
One Recipient vs. AllAs you have may noticed, triggering Custom Events can be done directly (one behavior) or indirectly (all behaviors). This to say:
Note: If a behavior doesn't have a Custom Event, and you try to trigger it, nothing happens. It's safely ignored.
|
















