put a family into a container?

0 favourites
  • 3 posts
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • Hello all;

    Suppose I have a family called mob which has orc sprite and troll sprite as members. Each member of mob has a health sprite bar. Whenever I select a mob by UID I want to get its health bar too. As things stand I have to put a health bar into a container with orc and another one into a container with troll and they can't be the same health bar.

    Is there a way to put the container in at the family level?

    Thanks for your time.

    yours

    winkr7

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I would do something like this : have health as a family instance var if not already. Give the health bar object you're using an instance var i.e. ID. On mob created, create health bar, set health bar. ID to mob.UID (now they are related). Then to display health you evaluate by saying where healthbar.ID = mob.UID set healthbar.health to mob.health.

  • Thanks plinkie. Thats a workaround and I appreciate your suggestion.

    yours

    winkr7

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