Download

Stupid noob question about using a FlipFlop for a Sprint system

Hey folks,

I’ve put together a simple sprint system that’s a toggle rather than a ‘hold down’ kinda deal.

Issue is I want the flipflop to revert when the player stops moving, otherwise the toggle stays on and the player immediately starts sprinting again when I resume moving.

Hi RedSaturnSix,
just delete the flipflop and feed the released exe to your stop. I hope that is what you want to achieve…

Sorry, must not have described what I was shooting for properly.

I want my sprint key to increase my max walk speed (character is now sprinting)
Pressing the sprint key again reduced the max walk speed (character is not sprinting)
Letting go of the direction key (wasd) also sets max walk speed back to it’s regular max walk speed so that when movement inputs start up again (wasd) the character doesn’t immediately start running at their sprint max walk speed.

It looks like the sprint key toggle should work? as for the wasd change, you do have a “set max walk speed to regular” connected to release on the forward/right inputs?

No. I don’t want the character to stop sprinting on the release. I want sprinting to be a toggle. So you don’t have to hold down shift the entire time you want to sprint.

However, as it currently stands, when I stop moving the character with wasd the blueprint still considers the flipflop to be active so when i start moving again the character continues to move at their sprint speed.

When the player stops inputting a direction (as in the character comes to a stop) i want the flip flop to be canceled.

Use a Boolean variable to enable and disable the sprint. When the player stops inputting a direction you set false for this variable and set the “Max Walk Speed” with its default value.

Your InputAction Sprint will become:

sprint.png

Edit:
Instead of using the “Play” and “Reverse” pins of the timeline, use the pins “Play from Start” and “Reserve from End”.

Hi @RedSaturnSix

Look at my example below:
SprintExample.jpg

In my example above, replace the custom event with Event Tick or a timer. This should act as a toggle when you press ‘Sprint’ and as soon as the character’s velocity is below a certain amount (in this case 0), reset the Max Walk Speed.

Let me know if this helps!

Thanks very much! Should be able to get this working now. :smiley: