playMaker

Author Topic: Idle x frames then do something !  (Read 2394 times)

Vanyfraise

  • Playmaker Newbie
  • *
  • Posts: 19
Idle x frames then do something !
« on: February 20, 2017, 03:35:06 AM »
Hi, I'm a brand new playmaker noob from France trying to make a game without c# or others code knowledge, i'm in teamdesign...

So, I want to make something happened when nothing is pressed (play animation, add int+1 etc.).
With my script, it's working, except if i press two buttons and release one after the other. Because script understand that i'm releasing a button so it's doing his job.
I guess i have to make a kind of conditionnal or something like that.

Have you got an idea ?

Thanks !
« Last Edit: February 21, 2017, 09:40:06 AM by Vanyfraise »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Idle x frames then do something ! (please)
« Reply #1 on: February 20, 2017, 08:59:48 AM »
Salut :)

 ok, so yes, you'll need to keep a counter for example.

 everytime a button is down, add 1 to the counter, everytime it's up substract 1, and so everytime a button is release do this, and then check the counter, if it's 0, you know nothing is pressed.

 does that help? I am not sure cause your title mention waiting x frames, which is done either with a simple "wait" action or a delyed event ( in SendEvent).

Bye,

 Jean

Vanyfraise

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Idle x frames then do something ! (please)
« Reply #2 on: February 20, 2017, 09:15:32 AM »
Merci !
I'll try this :)

Vanyfraise

  • Playmaker Newbie
  • *
  • Posts: 19
Re: Idle x frames then do something ! (please)
« Reply #3 on: February 21, 2017, 09:16:28 AM »
It works fine, except if i push two keys at the same time.

The count will stay at the -1 value or less.

[EDIT]
« Last Edit: February 22, 2017, 11:04:59 AM by Vanyfraise »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Idle x frames then do something !
« Reply #4 on: February 23, 2017, 05:37:44 AM »
Hi,

 you should split into two or more fsm.

 one fsm is dealing with horyzontal movement, one is dealing with vertical.

OR

you don't use keys but rather inputs, which will give you a vector for the input which is easier to work with ( use GetVectorAxis action for this).

 Bye,

 Jean