Tags

New releases and general discussions.

Post » Thu Feb 04, 2010 11:01 pm

That's a good perspective, madster. It sounds like a good way to implement it: families contain "base" variables, effects and behaviors, and objects in the family inherit them. The current "only those in common" is pretty obscure and was retro-fitted in after the main engine was written.

I wonder if we could even throw in encapsulation? Eg. variables only accessible by the object that owns them. Would that be useful in the real world? And polymorphism... can't think of a decent way that would fit in to events.
Scirra Founder
B
359
S
214
G
72
Posts: 22,949
Reputation: 178,544

Post » Fri Feb 05, 2010 6:41 am

I still have issues with families and variables, they always stop working, picking the wrong variables and stuff, and I think it could have to do with some bug with assigning new sprites to families and choosing to not have some variables. I've tried to make example .caps but the problem only happens in more elaborate games. I've managed fine without families but it's cumbersome.
B
5
S
2
G
3
Posts: 234
Reputation: 1,818

Post » Fri Feb 05, 2010 7:51 am

I've noticed that if you place more than one initial condition using a family, and a private variable its taken like Or, instead of And.


In the first event multiples as well as different objects are picked separately, as expected.
In the second any object the mouse is over, as well as the object with a private variable = 3 is picked.
Then in the third everything works as expected by using a sub event.

Am I not correct in assuming that conditions in the same line should be considered like And?
[url:1r7jx0d3]http://dl.dropbox.com/u/666516/familysubevents.cap[/url:1r7jx0d3]
Image Image
B
161
S
48
G
90
Posts: 7,347
Reputation: 66,749

Post » Fri Feb 05, 2010 7:04 pm

[quote="Ashley":1mzk1okg]I wonder if we could even throw in encapsulation? Eg. variables only accessible by the object that owns them. Would that be useful in the real world? And polymorphism... [/quote:1mzk1okg]
Well for once, you wouldn't be able to pick which family variables go in and which not (that in itself is weird to me). All vars from the family go in. When defining the family you would have to decide which variables (attributes) it has and their default values. These could be changed without having to touch the objects inside that family.

Encapsulation could be in the form that you could define an attribute (aka family variable) as private, and it wouldn't be accesible unless you were refering to the object via its family. Protected doesn't make sense in this context, as Construct's "methods" (behaviors) cannot read from other objects... can they?

Polymorphism... mmmm well for inheritance you could add families as members of other families, that would be nice. For polymorphism you'd have a family or object that's a member of several families (which is possible right now). What to do with an object that belongs to several families that have attributes with the same name? I'd say just forbid it and show a warning. It's a nightmare in any other way.

PS: I tried the familysubevents.cap but it's saved in a newer version and I'm not updating until I finish my current game =)
B
3
S
2
G
4
Posts: 1,445
Reputation: 4,665

Previous

Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 4 guests