Press "A" repeatedly

Hi Everyone,
a lot of games have this “Press A repeatedly” mechanics where you press a key multiple times and in doing so a animation gets pushed to its end (Press A to spin a valve for example). I would like to implement this in a project i am currently working on.

If the player stops tapping “A” (or any other key, its just an example) the animation should reverse to its start (i know spinning could be done without an animation but i would like to use this principle on other animationstyles too)

Spinning the thumbstick on your controller to do the same thing would be nice too, maybe someone has an idea to solve this :smiley:

thanks,

You should detect in your main input BP (or C++ Controller) what does it mean to stop pressing a button. Using a threshold between press/release events and then use that in the animation.

Then you just have to create your animations respond to start and stop events. In the BP you can achieve that with a DoOnce to start and reset it after a release has been detected that exceeds the threshold (or by time using the tick event or just a timer).

Do you still need assistance on the issue?

Yes i do :slight_smile:

Where you are so far?

Here’s a simple “Tap to Spin” Mechanic with Blueprints. Just an example, of the simplest mechanic that you mentioned. I used q, but any other input event could/would work.
You mentioned that you would like to use animation, so in place of the rotation node(s), you could cast to your animation blueprint and set the variables in there. For the lever example, you could have an animation that spins it 1 quarter for example, that you could cast to when you tap. A simple way to reverse that would be to have the same animation backwards, and every time you tap, it keeps track of the tap count and if you fail to tap within said time, it plays the reverse animation that many times back (at a speed multiplied by tap count) or until you tap again. Just an ideal :slight_smile:

I think this is exact what he needs. So if it’s the case please convert your comment to an answer ^^

I would use a timer. Once the key is pressed, it starts playing the animation and then 0.5s later (short timer) it calls an event which tells the animation to reverse (-1 playrate). Every time you press the button, you clear that timer, set the playrate to +1 and then restart the timer. Once the animation completes (can get this from a notify), you stop all communication.

The shorter you set that timer, the faster the player has to press the button. If they run out of stamina on too long of an animation, then it will just go backwards and pick up when they start tapping again. This is better than having the whole animation reset if you’re not fast enough…to me anyway.

well the youtube video looks just like what i want to archive^^
i think i should be able to replecate the blueprint shown in the video, but i would like it if the people here startet to use something like this:
http://blueprintue.com/ but thats of topic :smiley:

thanks Moss, thanks Mortusnyte :smiley: