playMaker

Author Topic: Global event?  (Read 2123 times)

liero116

  • Playmaker Newbie
  • *
  • Posts: 21
Global event?
« on: March 08, 2012, 07:55:43 AM »
What I'm trying to do is make it so that during ANY event, pressing a key/button/direction will set a variable to a certain value.  Is there a way to do this that doesn't involve adding a condition to every event?  I'm essentially looking for a way for an event to technically always be active and run in the background.

10Polarbears

  • Playmaker Newbie
  • *
  • Posts: 21
Re: Global event?
« Reply #1 on: March 08, 2012, 11:29:02 PM »
From what I can gather from your question:

First create global event.
- create new event then tick the check box to the left of the event name this will make it global
- then use "Get Key Down" to call that event while storing the result in a global/local variable if you need to.

To assist with this you will need to create a state that has an event attached as a transition.
This Start state has no actions attached just the global event as a transition. Because this event is global it can be called from anywhere by its name and that of its game object using "Send Event".
When called it will transition to its next state that has whatever actions you desire with it transitioning back to the initial state when the actions have been called. Again using "Send Event" not "Finished". This way it will loop back waiting for the next time it is called.

To start this process use "Send Event" from the state that is monitoring your "Get Key Down"