Hello, I am new to c++ and have been wanting to try my hand at unreal engine.
Currently my issue is that I have a character that has a “boost” feature named glide in my programming.
It has a maximum speed, acceleration speed, deceleration speed as well as a fuel gauge that ideally empties over boost time and refills when the player is not boosting. However when I am testing it seems the fuel never goes down and the character never reaches the maximum boost speed.
I assume the programming is correct for the debugging as when I hold the boost button down for 5 minutes the character speed never changes
What am I doing wrong here?
(The values when pressing the boost button turn into :
Character Speed 608.33
Fuel 99.99
Thank you in advance I am not skilled enough yet to apply other peoples answers and questions to my current situation as my grasp on the language is still not the best.
The problem is you are not continuously doing the acceleration and deceleration calculations in Tick but only once on Input Pressed (Glide) and Release (StopGliding).
If you extract the calculations into two functions you can do something like this in Tick
Thank you Garner, I thought this may be the case. I read the IE_PRESSED and IE_RELEASED and thought about how a sprint function works and the thought process of “As long as it’s held down the value stays the same”
Thinking of it more as a toggle between two numbers definitely shows me I should have experimented with that hypothesis.
Thank you for clearing this up for me, it’s very much appreciated!