Playmaker Forum

PlayMaker Help & Tips => PlayMaker Help => Topic started by: cloudjsh7 on April 04, 2018, 08:03:21 PM

Title: [2D] Tap once:attack, Tap twice: double attack HOW? [SOLVED]
Post by: cloudjsh7 on April 04, 2018, 08:03:21 PM
Making a 2D Platformer. Pretty new to Unity/Playmaker. I've figured out how to get my character to attack. However, I haven't been able to figure out how to make my character attack twice if I click the "Attack" button twice within a certain amount of time (maybe like one second or so).

Can anyone point me in the right direction?  ;D
Title: Re: [2D] Tap once:attack, Tap twice: double attack HOW?
Post by: tcmeric on April 04, 2018, 10:13:58 PM
You are looking for what I like to call 'a challenge condition'. (I have no idea of what its actually called).

As you may know, on one state, you can have two actions. Maybe right mouse click action and left mouse click action. That state is waiting for either mouse click.

Now, replace one mouse click with a wait action. So now you have a right mouse click and a wait. Whichever happens first, will decide what the next event/state will be.

So set your wait action to be around 0.1. or however long you want.
Title: Re: [2D] Tap once:attack, Tap twice: double attack HOW?
Post by: jeanfabre on April 05, 2018, 03:09:02 AM
Hi,

 yes, as Eric said.

 else you can use a framework for these, like Input.Touches or EasyTouch, they got all of this covered for you, and they work with PlayMaker.

 Bye,

 Jean
Title: Re: [2D] Tap once:attack, Tap twice: double attack HOW?
Post by: cloudjsh7 on April 05, 2018, 02:30:19 PM
EasyTouch seems to be deprecated.
Is 'Input.Touches' only for touch controls? I'm making a PC/Mac game with keyboard/Xbox controller inputs.

Also, is there way to maybe use some sort of "Time" function to make this happen?

Such as:

- Player clicks Attack Button (Get Key Down)
- Animation for the first attack fires (Animator Trigger or however I decide)
- A timer starts (????)
- If Player clicks Attack Button again before timer finishes then:
  - play second attack animation
  (if not)
  - go back to Idle animation or whatever
Title: Re: [2D] Tap once:attack, Tap twice: double attack HOW?
Post by: tcmeric on April 06, 2018, 11:47:56 PM
Hi, that is what the wait action does. It is a timer.
Title: Re: [2D] Tap once:attack, Tap twice: double attack HOW?
Post by: Pyremind on April 07, 2018, 06:54:55 AM
What action would you use to check if the click has happened before the timer is up, in your example?
Title: Re: [2D] Tap once:attack, Tap twice: double attack HOW?
Post by: tcmeric on April 07, 2018, 10:35:53 AM
Maybe this image will help
Title: Re: [2D] Tap once:attack, Tap twice: double attack HOW?
Post by: cloudjsh7 on April 07, 2018, 04:32:35 PM
@tcmeric

This worked great! Simple and thorough. Thank you!