How do I get life bars to act individually?

0 favourites
  • 3 posts
From the Asset Store
Safaryx
$4.50 USD
10% off
The game ends when the player loses all their lives
  • Hi Everyone,

    I'm doing a TD game and I'm having issue with the mob's health bars accurately representing the health of the mob it is attached to. Here is what I have, and any assistance is greatly appreciated.

    Tagged:

  • Anytime you try to affect something that has multiple instances (More than one of the same object) you need to specifically call the one you want in the condition. Sometimes this can be done automatically with built in features such as on collision automatically talks about the 2 (or more) objects that touched each other, or on created which specifically changes the instance that was created last.

    When changing your health bars you will need to call them - I suggest setting a variable to hold the UID of the monster they belong to. Then you can call the health bar with the variable = to Monster.UID.

    This video will help you out if you need more explanation:

    youtu.be/wbWGEanTg7I

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thanks, that wasn't very specific but it got me where I needed to go.

    Basically, you set a variable on the health bar object to the UID of the main object and then use the formula clamp(MobFam.Mob_Health/MobFam.Mob_MaxHealth*32,0,32) to have it go down.

    The formula was actually the piece I missing.

    If the construct team is reading this, you desperately need to put in a health bar behavior.

    **Edit

    I unfortunately had to do this again because the changes weren't saved for some reason. so I'm posting a screenshot of it in case it helps others.

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