replenish energy

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

  • allc1865allc1865 Member, PRO Posts: 777

    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.

  • allc1865allc1865 Member, PRO Posts: 777

    Nope, that won't do what you want, actually.
    Let me see if I can create a template.

  • ImNiklasImNiklas Member Posts: 103

    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 :)

  • allc1865allc1865 Member, PRO Posts: 777

    Try what @ImNiklas said as well

Sign In or Register to comment.