How do I assign an object to another one ?

Get help using Construct 2

Post » Thu Sep 24, 2015 9:07 pm

Hello,

I have a very simple question : I am making a game with many monsters, each of them as a health bar. Each monster is a different object (they are all different). Of course, these bars will evolve differently, according to the amount of damage taken by each monster.

What is the best way to do so ?

I can spawn a Bar by "spawn another object" from my Monsters Family, but then ALL the bars will decrease if ONE monster takes damage.
I could create a different bar for each monster, but as I have many monsters I am sure there is a better way to do so. What would you advise me to do ?

Regards,
Mogador
B
6
S
2
Posts: 32
Reputation: 575

Post » Thu Sep 24, 2015 9:45 pm

Hello

what i would do :
create an instance variable in the health bar called "monster_uid" for example
use "spawn another object" to create the bar and set the "monster_uid" instance variable to the uid of the monster
when a monster take damage, pick the bar by the uid of the monster
B
13
S
3
G
4
Posts: 70
Reputation: 3,451

Post » Fri Sep 25, 2015 11:27 am

Thank you very much :)
B
6
S
2
Posts: 32
Reputation: 575


Return to How do I....?

Who is online

Users browsing this forum: Sparkz and 1 guest