Text in Families

Discussion and feedback on Construct 2

Post » Mon Feb 06, 2012 10:52 pm

Is there a specific reason why Text objects cannot be included in the Families?
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Mon Feb 06, 2012 11:09 pm

What do you exactly mean? I can make a family of Text-objects. I suppose you cannot merge different object types.

greet, Joe7
B
14
S
6
G
5
Posts: 173
Reputation: 4,742

Post » Mon Feb 06, 2012 11:09 pm

Families can only include objects of the same type. So you can have a family of sprites, a family of text or a family of any other object type.
B
79
S
24
G
54
Posts: 4,746
Reputation: 40,755

Post » Mon Feb 06, 2012 11:20 pm

yeah I'm aware of that, but couldn't add text objects to a new/seperate family either. Quick C2 restart fixed that problem...strange.
ImageImageImageImage
B
140
S
58
G
36
Posts: 2,547
Reputation: 31,170

Post » Tue Feb 07, 2012 2:33 am

Families are associated with a particular plugin type (e.g. Sprite, Text etc). So you definitely can make families of Text objects. You're probably caught out by the fact C2 won't let you change the plugin of an existing family - you can't remove all the sprites from a sprite family then make it a text family, because that would make all the family's events invalid, so you may as well make a new family.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Feb 07, 2012 3:50 am

Are there any plans to include more than one object type in a single family?
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Tue Feb 07, 2012 4:57 am

No, you can't have multiple plugin types in a family - otherwise what happens when you make an event for it? Which conditions, actions and expressions are shown? If an object of one plugin type is picked, but you call an action or expression that plugin type doesn't have, what happens? It doesn't fit the design of families to support multiple plugins in one family.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Post » Tue Feb 07, 2012 11:04 am

But there will be a way to group different objects, right?
I can think of a couple situations in which that'd be useful, such as when you want to create/destroy/rotate/move an entire composite object at once.
It would automatically associate all instances with each other (for instance, a condition that selects one object would include all objects of that group into the SOL).

That would enable things like a tank emitting smoke particles, complete with a main cannon and a machine gun turret, with a health bar and a player name (for instance).Fimbul2012-02-07 11:11:03
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Tue Feb 07, 2012 2:02 pm

@Ashley

I would expect the family object to collect all the ACEs of all the object types that belongs to the family. It could filter the repeated ACEs and display them just once. The most common, or the ACEs that belongs to all of the types could be grouped in a Common category.

Then if you add a condition that only belongs to a specific type of object, during execution it would first filter all the family objects that have that same condition, and find the matching objects to be picked and added to the SOL.

For actions would be the same - first it would filter all the objects that have that same action, then for each object type of this list it would check if there's specific instances picked. If yes apply the actions to those instances. If not apply the actions to all of the objects of that type that belongs to that family.

This would mean that if there's an action that belongs to two kind of objects (sprite and text), and only one type of object is picked in the conditions (sprite: instances 2,3 and 4), that action would be applied to the picked instances of one type (sprite: instances 2,3 and 4) and also to all instances of the type not picked (text).

Then by adding a Pick object type condition to families, would be possible to disambiguate which object you want to apply the actions in case you want to affect just one type of object.

For expressions it would also work the same, with the only difference that when there's no specific instance picked that match that expression, it would return the value of the first object in the list.

I really wish that families could support multiple object types, specially to allow instance variable comparisons between different types of objects that could be used similarly to classes or tags.

Take a family of the respective objects and it's variables as an example:

Family "Scene":
Sprite: varClass = "rock", varShow = "False"
Sprite2: varClass = "grass", varShow = "False"
Sprite3: varClass = "rock", varShow = "False"
Text: varClass = "rock", varShow = "False"
Text2: varClass = "grass", varShow = "False"
TiledBG: varClass = "grass", varShow = "False"
TiledBG2: varClass = "rock", varShow = "False"

You could do this:

Family "Scene": variable varClass == "rock"
->Family "Scene": Set variable varShow to "True"

That would result in:

Sprite: varClass = "rock", varShow = "True"
Sprite2: varClass = "grass", varShow = "False"
Sprite3: varClass = "rock", varShow = "True"
Text: varClass = "rock", varShow = "True"
Text2: varClass = "grass", varShow = "False"
TiledBG: varClass = "grass", varShow = "False"
TiledBG2: varClass = "rock", varShow = "True"

This could open a whole new can of possibilities.
Animmaniac2012-02-07 16:18:05
Scirra Employee
B
129
S
45
G
15
Posts: 705
Reputation: 15,413

Post » Tue Feb 07, 2012 3:45 pm

@Animmaniac I'm afraid the engine is just not designed in a way that allows what you've described. It would need a lot of code rewriting... maybe one day in the future, but right now we have to get back to working down our todo list :-\
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,580

Next

Return to Construct 2 General

Who is online

Users browsing this forum: TheRealDannyyy and 13 guests