disable backwards sprinting
I have set up a sprinting action while moving and pressing shift.
do i have to split the movement into forward and backward? because the branch that checks if i move backwards when pressing shift the first time doesn't check again if i'm still holding the shift key.
hope this isn't too confusing.
asked Jan 09 '17 at 10:28 AM in Blueprint Scripting
as i couldn't really figure the gate thing out, i found two other solutions.
the easiest one was to just add a branch to the forward/backward movement axis that checks that axis is >=0 (which means the player is moving forward and/or sideways) and if the sprint key is being pressed, then set max walk speed to a sprint speed variable, if the input axis would be smaller (which means he is moving backwards) set the walk speed to a walking speed variable. this works as intended.
the second solution uses an enum (that has three different walking states in it: walking / running / crouching ) on an event tick. the event tick goes through branches that check if the player is moving forward or backward, pressing the sprint key or is crouching, stuff like that, and then sets the enum accordingly, going into a switch for the enum, that then sets the walking speed based on the enum. this also works nicely.
Because the Booleans are not being checked until keypresses, I would suggest using a gate. Have the gate run on a tick event and use the key presses to open and close the gate. Make the gate open event check those Booleans instead so they stay current and can be applied correctly at all times.
answered Jan 09 '17 at 11:28 AM
Very Simple Way
answered Mar 17 '18 at 05:25 AM
here is the simple way I apologise for my poor editing skills
answered May 18 '19 at 02:14 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here