Hi guys, I'm looking a best practice to create screen-by-screen system to reload sprites then set state their current values as persistent, then if they aren't on screen, destroy or disable sprites, then we are returned to old position, recreate sprites.
It's a method is used for super nintendo games like super metroid when the enemies aren't on screen, their AI are disabled, probably destroyed, otherwise on screen again, reactivate enemies.
Mostly, what I do (exemple with one ennemi type, also It is more the theoric part, you might have to tweak it):
-First if no instance of them exist deactivate the group containing the AI (you do this by having a "Compare two values : Sprite.Count = 0, disable group" inside the groups itself)., just below the group, add an Else and a subevent that tell "if ennemy is created, activate group"
-Have a boolean "Activated".
-You check if the ennemi is Active and not on screen, if it is not on screen, change the "Activated" boolean variable to False.
-You check the on screen ennemies, if one of them has "Activated" to false, you set it to true
-then if the value is true you do stuffs, if false, you can deactivzte behaviors and collisions.
I think that will help beginning.