Enemy health bars.

Get help using Construct 2

Post » Thu Jan 31, 2013 7:50 pm

He guys,

I need a little help with my enemy health bar. I am spawning enemies and I'm also spawning new health bars to go over there head like in a tower defense. But 1 thing i for got was when i scale 1 enemies health bar it scales them all.

I know threes a way to do this lol. Im also using an instance variable called health that is worth 100.Each hit subtracks 10 points from it and when its 0 the enemy dies. But that healthbar doesn't know i want to assign it to individual enemies.

Thanks in advanced. Happy crafting.
B
22
S
5
G
3
Posts: 194
Reputation: 5,855

Post » Thu Jan 31, 2013 7:56 pm

Use containers? That way, when you pick an enemy, it'll pick the healthbar associated with it too.
B
15
S
5
G
7
Posts: 877
Reputation: 5,650

Post » Thu Jan 31, 2013 7:56 pm

If you put the enemy and the health bar in a Container, when you pick a monster, it'll automatically pick it's health bar too.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973

Post » Thu Jan 31, 2013 9:10 pm

container? is that new to construct?
B
22
S
5
G
3
Posts: 194
Reputation: 5,855

Post » Thu Jan 31, 2013 9:10 pm

Im using C2
B
22
S
5
G
3
Posts: 194
Reputation: 5,855

Post » Thu Jan 31, 2013 9:26 pm

There was an extra html encoded space in the url I posted, and now it won't let me edit it.

Search the manual page for containers for all the info on them.
B
26
S
8
G
3
Posts: 210
Reputation: 5,973


Post » Thu Jan 31, 2013 11:57 pm

Thank you guys :DAarongamerX2013-02-01 01:53:08
B
22
S
5
G
3
Posts: 194
Reputation: 5,855

Post » Fri Feb 01, 2013 2:53 am

I ended up using the container. How long was that in Construct 2 lol. Must be recent.
B
22
S
5
G
3
Posts: 194
Reputation: 5,855

Post » Fri Feb 01, 2013 3:10 am

I think you could use variables and UIDs too, containers seems like a simpler (nicer) solution!
B
14
S
6
G
2
Posts: 136
Reputation: 3,210

Next

Return to How do I....?

Who is online

Users browsing this forum: Pandadoor, totoe, Zebbi and 19 guests