Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Stardog on November 28, 2011, 03:46:33 AM

Title: Multiple key presses (diagonals) [SOLVED]
Post by: Stardog on November 28, 2011, 03:46:33 AM
I've just started to learn PM, but I'm not sure how to do multiple key presses.

This is what I'm doing now.
(http://i.imgur.com/Ici5U.png)
Title: Re: Multiple key presses (diagonals)
Post by: jeanfabre on November 28, 2011, 05:43:15 AM
Hi,

 You would run into a problem by doing so.

 If i press left turn, then this fsm will move to state "leftpressed" and then would not be able to picke up for example a downdown key press.

There is an action that check for standard user input and let you dispatch events properly on multiple key press. If you want to do it manually, simply do one fsm per axis or key. The thing to be aware of with fsm is that only one state can be active at a time, so don't hesitate to split your tasks in different fsm.

 Hope this helps,

Bye,

Jean
Title: Re: Multiple key presses (diagonals)
Post by: Stardog on November 28, 2011, 07:55:19 AM
Ahh, the key was to add a different FSM for each key. Thanks!
Title: Re: Multiple key presses (diagonals)
Post by: jeanfabre on November 29, 2011, 04:47:22 AM
Hi,

 yes, tho I would precise that you actually can have fsm per "axis" not per key. Because you can't have left and right at the same time ( they would cancel each other), having one fsm per key "could" be the wrong path depending on what you want to achieve, but that's already very much dependant on your goal.

 Bye,

 Jean