Hello, I'm new here, but I've been trying to get a sprint stamina system to work for a while now. I don't think I'm going about it the correct way.
What I've been trying is to create a boolean method that returns true while the meter isn't 0. What I'm having issues coming up w/ is how to design the method to count down and where to call it. I am currently trying to call the boolean method (sprintStamina()) in an if statement inside of my update method where my movement code is, like this:
1 2 3 4 5
| if (input.run && input.right) { if (sprintStamina()) { xa = xa + 1; } } |
and my sprintStamina() method is where I'm having trouble coming up w/ the correct code to accomplish this. My sprintStamina() method is in shambles and very broken. I'm having trouble figuring this problem out. If anyone can help me, I'd appreciate it. If you need more detail as to what I'm trying to do, please ask.