Announcement

Collapse
No announcement yet.

Double tapping dash without hard-coding the key pressed

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Double tapping dash without hard-coding the key pressed

    Hi experts,

    I implemented a double tapping dash (like dodging) with WASD hard-coded. It was pretty simple, however I have no idea how to do this using something like "Moving forward key pressed" instead of "W pressed".

    It's frustrating to learn that "InputAxis MoveForward" is triggered every frame, and every tutorial I searched on this form hard-coded the key pressed. So I'm wondering if there is an event says "Move Forward key is pressed". So far I haven't identified an easy way to do this. I thought this should be trivial but I guess I was wrong.

    Thank you!

    #2
    All I can think of is a string of branches and gates watching the axis value. The first branch waits for axis =~1 then opens a gate, beyond the gate is another branch wating for axis =~0 then opens a second gate, beyond this gate is a final branch waiting for axis =~1 again and if cleared will fire your doubletap event. Branches 1 and 2 will use a sequence node to simultaneously open their next gate and start a delay that will close the same gate after x time. In all, 3 branch nodes, 2 gate nodes, 2 sequence nodes, 2 delay nodes.

    Comment


      #3
      You can add a new action mapping to WASD, and inside your key binding menu set both the action mapping and axis mapping key bindings. Works fine for my game. I still move where I want to move from the axis mapping, and double tapping still dodges.

      Comment

      Working...
      X