How can I pin multiple instances of a health bar to multiple instances of the the same enemy?

0 favourites
  • 2 posts
From the Asset Store
Pin UI
$2.49 USD
Create a perfectly Pinned Interface for Any Device
  • I'm in the process of making a game. The enemies that I have each have 3 health, and each time they're hit, one health is removed. I was wanting to have a health bar show up above them to indicate how much health they have left.

    However, I'm having trouble getting the health bars to pin to the right enemy. All of the health bars are pinning to one single enemy and only moving with that one.

    I want them to show up like this:

    But they keep only pinning to the enemy on the bottom and moving relative to him:

    I have different animation frames for the health bar object that I was going to change them to according to how much health is left for the enemy.

    Tagged:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Containers are your friend. If you check on the properties bar for the enemy you'll see a container option - click create and add the components of the health bar to the enemy's container. Now when you spawn an enemy it will also be spawned with its own health bar.

    You will need to pin the bar to the enemy on creation.

    Whenever you pick the enemy using conditions its health bar will also be picked and any actions will only apply to that enemy's bar.

    You can learn more about containers here: scirra.com/manual/150/containers

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