Deteriorating Health

0 favourites
  • 3 posts
From the Asset Store
Custom animated Health Bar - check youtube video to make it yourself
  • How do I script a health bar that is constantly deteriorating unless the player is in a certain zone?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Well, this should be easy:

    1. Add a private variable to your player - health.

    2. Create an even with the condition - "is player overlapping safe zone".

    3. Right click on the condition, press invert.

    4. Add a "substract x from player.health" action to the event.

    5. (optional) add an every x seconds to your event, for timing purposes

    Was that so hard?

    Kids in my day used to read the manual or watch the videos on Youtube,

    or at least think for themselves (i am yet to see someone ask more basic questions, sorry,

    i just feel that there is a lot of unnecessary content here - spam). Also, GET OFF MY LAWN!

    Update.

    If you meant an actual health bar:

    1. Make a 9-patch image with your health bar, set up as needed.

    2. Set the left side as a hotspot.

    3. Create an "every tick/x seconds" event.

    4. Add "set 9-patch width to player.health*SomeRandomAmount" to it.

  • If I remember correctly, the 9 Patch is one of the worst performing plugins you could use, and isn't really necessary for a life bar. You could just use a Sprite object filled with a color. For example, I have a red Sprite object drawn out to the width I want it to be, then a Green Sprite that lies on top of it, and it's width is determined by the player character's health (instance variable). Every tick, evaluate the player character health instance variable, and adjust the width of the green Sprite appropriately. It'd be better performance wise than the 9 Patch...

    I believe there's a tutorial here for this very thing.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)