Family Variables

New releases and general discussions.

Post » Fri Nov 07, 2008 6:25 pm

I'm posting this here, because I don't know if it is a bug or not; or if there are already any plans to change it. Also it's more of a change than a feature request.

The issue I have with family variables is as follows:

If you have 2 sprite objects for example; and you give one a private variable; then you give this object a family, say blue; then you make the second object part of the blue family; construct makes you give the second object the private variable of the first object. This variable now counts as a family variable.

This seems badly organised. What I'd like is an object to be able to have it's own values, and the values of its families all separate.

The problem really arises when you need lots of Families with variables, and some objects belong to multiple families. In this case all the objects would end up having all the same values, most of which would be completely redundant. Not to mention that none of these objects can even have their own private variables.

So you have an enemy in the enemies family, and he has private variables telling him when he can move//whatever, then ALL enemies have to have these values assigned to them, whether they move in the same way or not. Also if he is in the takes damage family, EVERYTHING that takes damage, not only has all the variables attached to it that an enemy does, but also all the variables for the original enemy that moves about.

Family variables should be listed in the properties tree, either under the family name, OR, the family name and its variables should be listed under private variables.

Basically what I'm saying is that family variables should be tied to a specific family, and not just be counted as a family variable when one of the objects in a family has that variable.

I just don't want all my objects to have about 50 variables when they only need 5.
It's quite a subtle point so I hope I've explained it well enough heh.
B
2
S
2
G
5
Posts: 236
Reputation: 2,122

Post » Fri Nov 07, 2008 10:37 pm

I think you're missing something; when you add a fresh sprite to a family with family variables, you don't have to add all the family variables to the sprite - it's just that any you don't add, won't be available via the family any more.

If you have a family with variables A, B and C, and you add an object with no variables to that family, you're prompted to add A, B and C to that object. You can untick some from the list - for example, leave only A ticked - and then the object only gets that value added. There is now only one family variable: A. If you previously had events referring to family variables B and C, they will be lost, which is why you are warned - but if there aren't any events for them it doesn't matter. So you don't have to have to include ALL of EVERY object's variables. In this case, you could still add variable D to the object, use it via the object's specific events, but it wouldn't be there in the family.

Does that make sense?
Scirra Founder
B
395
S
232
G
88
Posts: 24,371
Reputation: 193,762

Post » Sat Nov 08, 2008 12:11 am

Sorry maybe I should've done some more experimenting before I posted this. It does work, I thought it would delete it for ALL my families though. :oops:
Thanks for clearing it up though.
B
2
S
2
G
5
Posts: 236
Reputation: 2,122


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests