Playmaker Forum

PlayMaker News => General Discussion => Topic started by: VictorRayDev on April 05, 2013, 11:00:41 AM

Title: Detecting 2 button input [SOLVED]
Post by: VictorRayDev on April 05, 2013, 11:00:41 AM
Hi! Hope everybody doing fine!
Do you guys have an idea for the best way to detect if two
buttons are touched at the same time.

When I press left my character jump left.
When I press right my character jump right.
I'd like to introduce a new action if thos 2 button are pushed at the same time.
I think a way to do it is to make a little timer that when you press say right if the left button is pushed it send the third action...

Or is their a better way?
Thank you!
i'm now on twitter too! @VictorRayDev
Title: Re: Detecting 2 button input
Post by: VictorRayDev on April 05, 2013, 03:40:16 PM
I found that in code we can do something like this.

if(Input.GetButton("Fire1") && Input.GetButtonDown("Fire2") || Input.GetButton("Fire2") && Input.GetButtonDown("Fire1"));
trying to translate this into playmaker
Title: Re: Detecting 2 button input
Post by: Alex Chouls on April 05, 2013, 05:37:21 PM
You could store each button state in a bool variables using the Get Button action then use Bool tests (e.g. Bool All True) to send events.

Quote
I think a way to do it is to make a little timer that when you press say right if the left button is pushed it send the third action...

This is also a good approach, particularly if you want to create a "timeout" for the second button press. You can break your description down into states with a timeout. See attached image.
Title: Re: Detecting 2 button input
Post by: VictorRayDev on April 05, 2013, 06:50:56 PM
Excellent. Your second option suit what I want perfectly. Thanks Alex!