Hi guys, so I’ve been doing a game jam after learning some new modelling techniques and learning a little bit of coding, but came across a bit of a predicament. The answer is probably very simple, but Im not really a coder so its hard for me. Basically, I want it so you can only drag the body for a certain amount of time and then it just drops, then it has a recharge time, after which you can do it all again.
What would be even more helpful, since I never got the hang of this, is if you could also help me, or alternatively link me to a tutorial, to link that to an energy bar which decreases when the drag is being used up and increases when it is recharging.
Many thanks
Tom
energy bars are usually just float values which are decremented during the update function when the relevant action is being performed, and increased when the action isn’t (or not if there is no recovery I guess)… I guess the simplest method would be to have an enum state which indicates what the character is doing and then a case statement in the update function to increase/decrease the energy bar by some amount (inspector variables for rate of loss/gain * time.deltaTime for frame rate independence etc.)
Thanks so much for your help. However, as I said Im still learning coding, and rather embarrassingly it turns out Im not as good as I thought I was, so I dont really understand how to do this. Im not saying you have to spend your time writing a script for me (although that would be appreciated greatly), but some more detail, or even better a tutorial!
Thanks again mate