I have a mechanic in my game where enemies respawn after a set amount of time. Rather than storing each enemy spawn-point in an array including all their various instance variables, I have a Spawner object that recreates all the enemies of the correct family after a certain time has passed (the countdown is set when the enemy is destroyed).
In my game as well, enemies only die when a certain variable matches a certain other variable. Specifically, an enemy has to match the colour of the backdrop (the backdrop is one variable, the enemy colour is another, a condition checks if they match, and they destroys the enemy if they match).
No enemy starts off in the same colour as the backdrop - the character has to change their colour with a magic brush.
The problem is, when the spawner recreates the enemies, the enemies respawn and then die immediately. I assume this is because their instance variable isn't set to match their starting conditions.
If I'm right, this doesn't seem to be as I understood recreate to work - shouldn't it recreate the enemy in it's original condition? Shouldn't this include instance variable settings? If not, what am I missing here? What is causing this to fail?
I can't find any clear guidance on recreate anywhere on the site. The manual doesn't mention it, and the online help doesn't mention instance variables. I also found no discussion on the forums, but I could have missed something.
Thanks for any help rendered!