Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: G-Kaiser on December 13, 2014, 06:52:22 AM

Title: How to Set Up Logic For An FSM
Post by: G-Kaiser on December 13, 2014, 06:52:22 AM
I would like to disable an FSM if certain conditions are met: If up and right are pressed within a certain amount of time it will disable the FSM. How can I go about doing such a thing? I know that I have to use boolean variables, but how can set up the logic to make it work?
Title: Re: How to Set Up Logic For An FSM
Post by: jeanfabre on December 16, 2014, 02:53:34 AM
Hi,

many ways to achieve this:

one way:
 
-- one fsm will watch the up time and send a global event "UP LONG PRESS" or soemthing
-- a second fsm will watch the right and send a global event "RIGHT LONG PRESS"

-- both will also fire a "COMBO CANCELED" is the up or right key is released before the time out.

a third fsm will listen to these three events, and if it get both long press, disable the targeted fsm using the action "enable behavior"

You can certaintly create a more complex fsm, but there is nothing wrong in having multiple fsm.


 Experiment with this. If you are going nowhere :) I'll do a sample.

Bye,

 Jean