Referencing/replacing families

Get help using Construct 2

Post » Wed Sep 24, 2014 3:41 pm

Is there any way to change or replace references to families during runtime?

For example I have two families of sprites. During the whole of the code, it is set up so the player controls 1 of the families, with events like these:
Click "Family1" -> stuff happens.

But then I want to change it around so all these interactions can happen with "Family2" instead, depending on player choice while the game is running. Is there a somewhat easy way to do that, maybe by have it changing according to a global variable that says player is either "family1" or "family2"?

So far it seems there is no way to either exchange family names, or even change the contents of a family, while the game is running. So is there some other workaround?

So far all I can think of is making an identical set of code for each family, but that would be huge and complicated, not to speak of making sure they are always the same whenever I got to change something in one of them.
B
10
S
3
G
3
Posts: 110
Reputation: 2,206

Post » Wed Sep 24, 2014 3:58 pm

Some things off the top of my head:

You can spawn a similar sprite from the same family with different instance values

You can literally copy paste code

You can add the sprite to both families and give it an instance variable to compare which one is active
Developing Surolace, the survival role playing space game.

surolace-survival-role-playing-space-game_t116953
B
14
S
4
Posts: 303
Reputation: 1,730

Post » Wed Sep 24, 2014 5:32 pm

yeah you can assign the same objects to two different families, and separate picking them that way
B
87
S
44
G
16
Posts: 1,005
Reputation: 17,938

Post » Thu Sep 25, 2014 8:21 am

I might try the thing with having two different families with the same objects, yes! Will see if that does the trick.
B
10
S
3
G
3
Posts: 110
Reputation: 2,206


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 26 guests