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 !
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.
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 !
Develop games in your browser. Powerful, performant & highly capable.
It's with UID ? but how ?
I don't understand the topic.
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"
Every Tick | set position of "health_bar" : to Zombie
Every Tick | Set health_bar.width : to Zombie Instance variable "Health"
This should be simple enough
https://dl.dropboxusercontent.com/u/521 ... thbar.capx
Thanks i will try.
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.
yw
As long it helps