0 Favourites

Referencing/replacing families

  • 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.

  • 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

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • yeah you can assign the same objects to two different families, and separate picking them that way

  • I might try the thing with having two different families with the same objects, yes! Will see if that does the trick.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)