I’m try to do something like Zelda Skyward Sword, when the character move around and spend energy. I did it work with Jump Pressed/Released and tried to do it on movements right/left; forward/backward. I managed to do this to test if both worked well, and yes. But I’ve tested several possible ways to make it work - when the character lose energy while moving around the place, and so soon after it, he gets tired and need to stay with delibitated movements and stop moving for directions to recover the energy, and right after, its movements back to normal -. I didn’t. So I decided to ask for help to you about this. If you can help, thank you. =)
If you are solely using blueprints and don’t have the ability to create your own movement components you can create a float variable that decrements with the axis input value. If it hits zero, get your movement component and set the max speed variable to your new value. Assuming your stamina recovers in Tick you would do a check to see whether the current stamina is equal to some threshold that allows the player to run. If it is, set the movement component speed back to the default.
I tried to make the character move the way I cited above, and also switch between Idle/ Walk; Run with energy and no energy, but only one worked and the other didn’t. Never counted the steps of the character to cancel the energy making it movement slow down when it reaches 0.
Now I am slightly confused about what you are asking for help for. Are you asking what the best implementation is or are you asking how to implement a certain behavior?
I haven’t played Skyward Sword myself so I am unfamiliar with the specific behavior you want. If you would like a generic stamina meter you can try implementing it the way I described above. Whatever you decide to do you will need to access the movement component and set the max speed variable to whatever you need it to be. This will cause your player to move slower or faster.
If the above behavior isn’t what you wanted please state as clearly an in depth as you can what you are expecting the behavior to be. Explain the process to me, starting from what happens when the player presses the move button to the conditions that cause the slowdown to the way the player can recover their stamina.
The first key binding is your run key. When it is pressed you would set Running bool to true. When it is released you set it to false.
The second key bind you need is your movement key. If it is an action key you would set a bool if it is pressed and unset the bool when it is released. If it is an axis key you can simply check if the axis value is greater than 0.5.
Next, in your Tick method you would use a branch node to check if your Running bool is true and if the action key is pressed (using the method I described above). If it is true you would get the movement component and set its max speed to, for example, 1000. If it is false you would get the movement component and set its max speed to, for example, 600.