How do I seperate healthBAR to each enemy

Get help using Construct 2

Post » Fri Dec 26, 2014 12:24 pm

I'm modifing a game based on the turret defence game template .
I want to add a health bar to each new enemy, so when an enemy is spawned I also spawn an healthBar spite and pin it to the enemy. Every time the enemy is hit I modify the healthBar width to enemy's health instance variable.
This method doesn't work as all healthBar on the screen get the same value and are destroyed when the first enemy is detroyed...
Spawning a healthBar when Spawning a new enemy

Adjusting the healthBar as enemy gets hit

How can I adjust the only hit enemy's healthBar?
How can I destroy the healthBar when the enemy iss dead?

You do not have the required permissions to view the files attached to this post.
Posts: 31
Reputation: 431

Post » Fri Dec 26, 2014 1:29 pm

You have to work with UID and set the enemeys UID to the healtbar. For destroying the healthbar you just have to check for the UID too.
To make it right you should work with functions.

Read this: ... moke-trail
Read this:
yeah, i really like to say that you should "Read this:"
Posts: 140
Reputation: 1,899

Return to How do I....?

Who is online

Users browsing this forum: The Mnk and 2 guests