Instance variable problem

Get help using Construct 2

Post » Fri Mar 29, 2013 10:49 am

I looked for it in the whole forum but didn't find what I needed(Maybe there it is, but I didn't find it)..

I have a project built in this way:
System -> On start of layout -> Create object monster on layer 1 at position random(1280), random(1024)
Create object text_monster_hp on layer 1 at monster.X, monster.Y-100
With a repeat of 10 times.

So, in short words, I create, at the start of the layout, 10 monsters with a text above them showing their HP points(HP is a variable called "vita" in the instance)

Then I have a thing like this:
System - Pick all monster - Set text_monster_hp text to "Vita: " & monster.vita

And it works..
But how can I say "If variable 'vita' is less then 0, destroy monster and relative text_monster_hp"?
Because with a subevent in pick all monster like this:
monster -> vita<=0 -> monster.destroy, text_monster_hp.destroy
The monster destroys correctly, but ALL texts are destroyed, and not just the one relative to the monster killed!

*So, what I'm asking is: How can I say that a sprite must be relative to another one?

I hope I was clear, I'm sorry for my bad eng but I'm italian!
Thanks in advance, Cadienvan!
Posts: 5
Reputation: 443

Post » Fri Mar 29, 2013 11:55 am

Solved it with containers!
Posts: 5
Reputation: 443

Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, bangoo, GloryF90, Google [Bot], MrWhizm and 22 guests