Individual unit health bars

Get help using Construct 2

Post » Wed Feb 26, 2014 10:24 am

Hello again C2 community.

Every time I think I'm getting the hag of the event system I try something out and POW, back to square one.

I'm using the RTS template, and am currently trying to create health bars for my individual units.

I'm trying to follow the same method used in the template to tie health bars to bases as is used to tie tank turrets to bases;

Image
Image

So I create my health bar from 2 sprites, put it in a container and use the same technique (initially with just one health bar), and it works great;
Image
Image

However all health bars seem to just stick to the one tank base. I don't understand why the technique works fine for tank and turret but not for me new health bar.

Image

Sorry, I can't include urls (to capx) due to my low cred. But I hope the images will show.
B
5
S
1
Posts: 34
Reputation: 364

Post » Wed Feb 26, 2014 10:42 am

Are you sure your health bars are also in the same container with your tank bases and turrets? (Just putting health bars in a seperate container will not work, the container must have tank base, tank turret, and two health bars)
B
17
S
4
G
1
Posts: 332
Reputation: 3,099

Post » Wed Feb 26, 2014 10:50 am

Windwalker wrote:Are you sure your health bars are also in the same container with your tank bases and turrets? (Just putting health bars in a separate container will not work, the container must have tank base, tank turret, and two health bars)


That's a really good point, so I add my health bar components to the same group as the turret and base;
Image

It's working now - but It appears that the assignment of a health bar is pretty random.

Do I need to delete and recreate each tank to bring the UID's closer together?

Image

UPDATE

Deleting all the tanks and recreating them from (copy in memory) has done the trick, thanks for your help Windwalker.

Image
B
5
S
1
Posts: 34
Reputation: 364

Post » Thu Feb 27, 2014 1:20 pm

You are welcome :) In time I learnt most of the time it's actually a very simple thing that evades the eye to solve your problems in C2. Keep sharing your stuff and gl :)
B
17
S
4
G
1
Posts: 332
Reputation: 3,099


Return to How do I....?

Who is online

Users browsing this forum: HenryPK, Syazanie Amirin and 7 guests