Families within families?

This forum is currently in read-only mode.
From the Asset Store
A collection of various zombie characters sprites for creating a 2D platformer or sidescroller game
  • I'd like to make object sub-types, but I'm afraid I don't see how.

    For example, pretend that you want to make a Family named 'Human Being'. All human beings have some common private variables (eye color, height/weight, a first name, etc) and behaviors (breathe oxygen, eat food).

    Furthermore, we could say that there are two sub-families of human being - male and female. All males share certain traits and same for the females. Furthermore, there are sub-families of males and females (Korean, Russian, African...) that have certain traits and behaviors in common. I think you can see what I mean.

    My end goal is to have NPCs that are unique but I don't want to have to re-write the same private variables and behaviors over and over again for every single NPC. I'd like to just say "Here is a human being, male, Canadian, caucasian, firefighter, named Joe" and then Joe would automatically inherit all of the variables and behaviors common to human beings, males, Canadians, caucasians, and firefighters. Then, I'd only need to tweak the few remaining details that are specific to Joe and not shared by any of the rest of the human male Canadian caucasian firefighters.

    It almost seems like Construct allows you to place families within families like this, except that it causes the application to crash every time I attempt it. Is there another way to do what I am trying to do?

    Thank you.

  • It almost seems like Construct allows you to place families within families like this, except that it causes the application to crash every time I attempt it.

    That's a bug! How do you reproduce it? Can you submit it to the tracker?

    The engine doesn't support families-in-families. Families are just a way of applying events to a group of object types, so I'm not sure what a sub-family would do that's different to just having a separate family for that purpose. What you want, of course, is just plain old inheritence like programmers are used to, but Construct hasn't got any formal inheritence features yet.

    You might also be able to get something going with private variables to configure things. I find it a really handy way to set up families. For example, you'd have your "NPC" family, and you'd have text family variables like "Race", "Sex", "Career", "Job" etc. Then in the layout editor you can just type these in to the properties bar, and access the variables from the event sheet editor.

    Would that do the trick?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You are correct, I was looking for inheritance. I can make my game without it but I didn't know if Construct had inheritance and I was overlooking it.

    Thanks! I will post the bug to the tracker.

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