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.
Develop games in your browser. Powerful, performant & highly capable.
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.