How do I assign an object to another one ?

  • 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

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Thank you very much

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