playMaker

Author Topic: Multiple key presses (diagonals) [SOLVED]  (Read 3789 times)

Stardog

  • Playmaker Newbie
  • *
  • Posts: 5
Multiple key presses (diagonals) [SOLVED]
« 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.
« Last Edit: November 30, 2011, 06:05:12 PM by alexchouls »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Multiple key presses (diagonals)
« Reply #1 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

Stardog

  • Playmaker Newbie
  • *
  • Posts: 5
Re: Multiple key presses (diagonals)
« Reply #2 on: November 28, 2011, 07:55:19 AM »
Ahh, the key was to add a different FSM for each key. Thanks!

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Multiple key presses (diagonals)
« Reply #3 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