I've been dealing with a character swapping issue for several months now, and I was wondering if we could examine methods for doing so in-game during play without pausing. My specific scenario is as follows:
I have three character containers at all times. At any moment, however, these can be switched to any one of four character designs (which involves several sprites being swapped out). To give a drastically oversimplified example: Mario gets replaced by Luigi, Peach, or Toad on queue, and each character involves a unique set of costume accessories in child sprites which also have to get swapped out.
The amount of animations involved and the possibility of adding more in later makes simply stacking everything into one sprite's animations unwieldy and inextensible. (As was the suggestion here).
The fact that UID's can't be predicted and IIDs can be dynamically updated makes these unreliable, as I cannot talk to any of my objects once I destroy one instance and replace it with another. I've managed to use a Local variable number to refer to the characters with limited success, but I can't figure out how to reassign the number to an object after swapping. For example:
Character IID 3 is assigned localVar value 2.
Character IID 3 needs to be swapped out, and so is destroyed.
New character is immediately swapped back in, but the IIDs are all wrong now and I can't figure out how to specify the new instance to reassign localVar value 2.
I've also seen this tutorial, but that scenario seems to involve switching between objects which never get removed or added back to the layout, and all exist simultaneously.
I'm starting to think in circles. Am I simply approaching this from the wrong mindset?
I've tried making use of Families and Containers. Unless I'm mistaken, containers don't allow you to selectively destroy/spawn one single child sprite. Families, meanwhile, suffer the same UID/IID limitations as their Sprite children.