# how to use my double button press with an axis event movement.

**URL:** <https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222>\
**Category:** UI\
**Tags:** button, compatibility, Input, axis, unreal-engine, question, Blueprint\
**Created:** [June 4, 2020, 6:05am UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222 "2020-06-04T06:05:47Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![anonymous\_user\_7e6055c71](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7e6055c71](https://forums.unrealengine.com/u/anonymous_user_7e6055c71)\
**Post date:** [June 4, 2020, 6:05am UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/1 "2020-06-04T06:05:47Z")

</div>

hello everyone, im new here.  
im not a programmer but ive played with this a lot before asking for help.

problem: implemented double-tap/click does not work with axis mapping.  
this is a problem because i want the player to be able to change mapping later so i don’t want to bind actual keys to movement in the blueprints.

i have double click as a function  
then after input axis event, i call the function (I’m trying to 2 things with the same key)

if the single press, it will move the character in the desired direction  
if double hit, it will dash or jump/flip the character in the desired direction

video [Unreal Engine 4 25 1 input axis mapping wont allow double tap click please help - YouTube](https://youtu.be/pQCLupUu_xw)

---

<div class="post-metadata">

**Author:** ![DDemon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DDemon](https://forums.unrealengine.com/u/DDemon)\
**Post date:** [June 4, 2020, 6:47am UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/2 "2020-06-04T06:47:51Z")

</div>

If you ask me it looks like a bad way to do a double-tap, you creating an input delay with your Delay try to do it with only a branch and sequence with a delay then if the button pressed twice change the condition to false/true and go to double-tap and don’t use axis for double-tap leave the other logic there but move the double-tap to button press. Axis always gets input almost like tick what you need is only when you press the button to get a input not constant and if not mistaken you can change mapping whatever you want in blueprint so you don’t need to worry about that as well.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7e6055c71](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7e6055c71](https://forums.unrealengine.com/u/anonymous_user_7e6055c71)\
**Post date:** [June 4, 2020, 1:34pm UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/3 "2020-06-04T13:34:48Z")

</div>

ok thanks, ill try the changes as well.

idk much about blueprints (i only know a small amount of logic)

ill set it up with the key instead, my big plan is to make it so every value in the game can be configured later. for right now im just learning the blueprint system the best i can.

thanks for the response, i fell asleep lol.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7e6055c71](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7e6055c71](https://forums.unrealengine.com/u/anonymous_user_7e6055c71)\
**Post date:** [June 4, 2020, 2:13pm UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/4 "2020-06-04T14:13:07Z")

</div>

i tried without the delay, and even tried a few ways without setting a var, if i do not have a delay but i use a sequence, then it won’t detect the second press. ill just keep a delay i guess.

the code i showed wasn’t 100% working because it wasn’t always detecting. but what i have now is so ill use this for now and try to make it better in the future.

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [June 4, 2020, 4:19pm UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/5 "2020-06-04T16:19:48Z")

</div>

Here’s my take on it:

First, leave your axis input alone and create an action input with the same key. Yes, they will both work simultaneously.

Next, I came up with this:

 ![303585-dash.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/3/6/b3619487c18593b2567d4252c6fec2270c096653.png)

Create 3 variables: 1 bool and 2 floats (Is Dash Allowed, Time to Double Tap, and Delay Before Next Dash respectively). Time to Double Tap is time within which the player has to press the key the second time; the other two are pretty much self-explanatory.

Dash Gate is a custom function that you can create yourself. Otherwise you can just connect the respective execution pins to Open Gate and Close Gate, but this way it’s cleaner.

Hope this helps.

Edit: P.S. Make sure to uncheck the Start Closed in the Gate node, or it will never work.

---

<div class="post-metadata">

**Author:** ![DDemon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DDemon](https://forums.unrealengine.com/u/DDemon)\
**Post date:** [June 4, 2020, 4:43pm UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/6 "2020-06-04T16:43:52Z")

</div>

Nice double tap but totally overkill

---

<div class="post-metadata">

**Author:** ![Tuerer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/tuerer/32/1008648_2.png) [@Tuerer](https://forums.unrealengine.com/u/Tuerer)\
**Post date:** [June 4, 2020, 5:01pm UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/7 "2020-06-04T17:01:18Z")

</div>

That’s not even my final form!

I mean, you do want to observe some conditions, at least the time between the first and the second taps. The delay is optional, of course.

Here’s a simpler version with no delay and no variables:

 ![303578-dash.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/7/d/47d91eac98bb44c7605da7eec5007042279b0787.png)

---

<div class="post-metadata">

**Author:** ![DDemon](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@DDemon](https://forums.unrealengine.com/u/DDemon)\
**Post date:** [June 4, 2020, 5:54pm UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/8 "2020-06-04T17:54:09Z")

</div>

Holy moly, I usually don’t use a lot of gates and timers so even though I do understand it this is a little bit over my head.

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_7e6055c71](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_7e6055c71](https://forums.unrealengine.com/u/anonymous_user_7e6055c71)\
**Post date:** [June 5, 2020, 4:00pm UTC](https://forums.unrealengine.com/t/how-to-use-my-double-button-press-with-an-axis-event-movement/466222/9 "2020-06-05T16:00:50Z")

</div>

Thanks for the responses, im using your second one.

i would have liked to make this into a macro or function, timers and events cant be used in a function or macro.

im trying to make it so i can use this multiple times. im also trying to make the character dash in whatever direction the player “inputs”  
im also using the “DoubleTap” to change from run to sprint

i have it set up where pressing the movement keys make you walk  
if you hold shift then you run  
if you double tap a directional key while holding shift then you sprint  
walking uses no stamina  
running depletes stamina at the same rate that you can restore it (regen wont happen while running)  
and sprinting uses up stamina 2x as fast as it can regen

your code is magnificent, im just trying to be more efficient with how much code is added.
