Families within families?

For questions about using Classic.

Post » Sat Jan 17, 2009 12:40 am

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.
B
1
G
3
Posts: 4
Reputation: 833

Post » Sat Jan 17, 2009 1:22 am

[quote="RealDeal":20v8a6jj]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.[/quote:20v8a6jj]
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?
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,508

Post » Sat Jan 17, 2009 1:45 am

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.
B
1
G
3
Posts: 4
Reputation: 833


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 3 guests