How do I life bar to each zombie.

Get help using Construct 2

Post » Mon Mar 31, 2014 7:54 pm

Hello (excuse my english),

How do I a life bar for each sprite ?
For example : On a zombie walking animation.
I would like to add a health bar above the head zombie.

how to connect easily each zombie to his life bar ?

Thanks !
B
12
S
3
Posts: 147
Reputation: 2,021

Post » Mon Mar 31, 2014 7:59 pm

Have a look at this topic.

Basically use the Pin behavior to pin the HP bar to your zombie, and have a instance variable on the zombie set the amount of life left.
B
20
S
6
G
4
Posts: 347
Reputation: 4,451

Post » Mon Mar 31, 2014 9:08 pm

Yes i successfully "pinned" the zombie to life bar "on start layout" but how to make the life bar is connected to the good zombie.
when a zombie is hit all bars lives down !
B
12
S
3
Posts: 147
Reputation: 2,021

Post » Mon Mar 31, 2014 9:47 pm

It's with UID ? but how ?

I don't understand the topic.
B
12
S
3
Posts: 147
Reputation: 2,021

Post » Tue Apr 01, 2014 12:00 am

I've never used the pin to function.. I like to use "set position to" That said, I would do an every tick set position of the HP bar to each zombie, along with setting the width of the HP bar to the instance variable that is used for zombie health. You will most likely need a "for each" statement as well.

So something like:

For Each : Zombie
> Every Tick | set position of "health_bar" : to Zombie
> Every Tick | Set health_bar.width : to Zombie Instance variable "Health"
Image Image Image
B
61
S
19
G
6
Posts: 325
Reputation: 7,944

Post » Tue Apr 01, 2014 8:11 am

B
47
S
10
G
5
Posts: 232
Reputation: 7,561

Post » Tue Apr 01, 2014 9:57 am

Thanks i will try.
B
12
S
3
Posts: 147
Reputation: 2,021

Post » Tue Apr 01, 2014 12:57 pm

Thanks Miu3 ! for the file.

I did not know the container. ;)
That is why I broke my head with UID to connect the zombie and life bar.

It works.
B
12
S
3
Posts: 147
Reputation: 2,021

Post » Tue Apr 01, 2014 6:19 pm

yw
As long it helps :)
B
47
S
10
G
5
Posts: 232
Reputation: 7,561


Return to How do I....?

Who is online

Users browsing this forum: digitalsoapbox, RetrocadeMedia and 1 guest