replenish energy
lpetrowicz
Member Posts: 12
two things I am looking for assistance with. I am wanting to create an energy bar that will decrease as the game goes on but also have an object that can be collected to raise the energy bar again. Any thoughts on how this could be done? Thanks.
Comments
Yep.
have a boolean attribute called energyBar
In your energy bar actor put a timer behavior in there. The timer will say every 4 seconds or so change attribute energyBar to energyBar -0.5 <-- I think that number will do it. If not then try .75.
I haven't tested it but that's how I think you could do it.
Nope, that won't do what you want, actually.
Let me see if I can create a template.
This is what I did:
Timer Every 0.05 Seconds
--Change Attribute health to health - (0.05 / secondsTheTimerRuns)
Constrain Attribute self.size.width to health * sizeYouWantTheHealthBarToBe
Constrain Attribute self.position.x to self.size.width/2 + xPositionLeftOnTheHealthBar
i also added the visual effect of the healt bar to make it easier for you Then you just have on any actor that adds x to health when something happens.
Good luck with the game, I hope this helps you
Hope this helps!
https://www.dropbox.com/s/ymjgmuhpg397uhq/energyBar.zip
Try what @ImNiklas said as well