playMaker

Author Topic: [2D] Tap once:attack, Tap twice: double attack HOW? [SOLVED]  (Read 2895 times)

cloudjsh7

  • Playmaker Newbie
  • *
  • Posts: 5
[2D] Tap once:attack, Tap twice: double attack HOW? [SOLVED]
« 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
« Last Edit: April 08, 2018, 07:03:27 PM by cloudjsh7 »

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: [2D] Tap once:attack, Tap twice: double attack HOW?
« Reply #1 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.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: [2D] Tap once:attack, Tap twice: double attack HOW?
« Reply #2 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

cloudjsh7

  • Playmaker Newbie
  • *
  • Posts: 5
Re: [2D] Tap once:attack, Tap twice: double attack HOW?
« Reply #3 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

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: [2D] Tap once:attack, Tap twice: double attack HOW?
« Reply #4 on: April 06, 2018, 11:47:56 PM »
Hi, that is what the wait action does. It is a timer.

Pyremind

  • Playmaker Newbie
  • *
  • Posts: 14
Re: [2D] Tap once:attack, Tap twice: double attack HOW?
« Reply #5 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?

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: [2D] Tap once:attack, Tap twice: double attack HOW?
« Reply #6 on: April 07, 2018, 10:35:53 AM »
Maybe this image will help
« Last Edit: April 07, 2018, 10:43:18 AM by tcmeric »

cloudjsh7

  • Playmaker Newbie
  • *
  • Posts: 5
Re: [2D] Tap once:attack, Tap twice: double attack HOW?
« Reply #7 on: April 07, 2018, 04:32:35 PM »
@tcmeric

This worked great! Simple and thorough. Thank you!