Instance variable problem

0 favourites
  • 2 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Solved it with containers!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)