Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: Vanyfraise on February 20, 2017, 03:35:06 AM

Title: Idle x frames then do something !
Post by: Vanyfraise 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 !
Title: Re: Idle x frames then do something ! (please)
Post by: jeanfabre 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
Title: Re: Idle x frames then do something ! (please)
Post by: Vanyfraise on February 20, 2017, 09:15:32 AM
Merci !
I'll try this :)
Title: Re: Idle x frames then do something ! (please)
Post by: Vanyfraise 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]
Title: Re: Idle x frames then do something !
Post by: jeanfabre 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