Say I have a container (mc) that I add to my game that contains a certain type of collectable (lets just say coins). I add that to my level container. I create an array for the coin container. Every time the player touches a coin I removeChild the coin from the container and remove it from the array as well.
All of this works fine. But say the player beats the game and they click replay. All of the coins are no longer in the coin container because they were removed from previous game session (through removeChild).
Is there a way around this without having to add all the coins back into the container manually? Seems a bit extreme to do it this way if say there were 100 coins in the container.
Would repeating the code , for example, coinContainer = new CoinContainer when the replay button is clicked fix this?
Any feedback would be greatly appreciated. I'm still relatively new to using arrays and loops.