That's an interesting idea, setting a flag/variable when an enemy is deactivated, then running a loop after to deal with them, I'd previously tried doing it with a loop running on each enemy individually, which didn't seem to work (I'm a few years into learning coding and sadly scoping through loops still causes me a lot of problems).
I've spent a few more hours working on this problem since posting this thread, and the approach I arrived at seems to work quite well, I'll try to explain it as simply as I can.
1. I have a camera object in the centre of each screen, which the game camera is focused on. When the player leaves the room via the Top, Bottom, Left or Right doors, the camera then jumps the required number of pixels in each direction in order to centre it in the next room
2. On top of this camera I have a 'Spawner Activator' object, which is the same size as each room. When it overlaps the enemy spawners, it triggers the loops which spawn the corresponding enemies and sets their ID value to that of the spawner, and then sets a variable in each spawner to 1 afterwards so the enemy only spawns once. The enemies themselves only exist as long as they're overlapped by the Room Spawner.
3. If the player kills an enemy whilst it's overlapped as per the above, the enemy's ID value is then stored in another object, which is always running a loop for every spawner. If the value matches the spawner's Fixed Value, the spawner is then destroyed.
4. If the player leaves the room without killing the enemy however, so the Room Spawner object is no longer overlapping them, the enemy is immediately destroyed and the spawner variable is reset to 0.
There is however a bug with my approach:
If you leave an enemy room and go into one with no enemies the above approach works fine, it'll turn the enemies on and off without trouble. If however the next room also has enemies in it, the ones in the previous room won't be switched off, probably because the Room Spawner object doesn't know which enemies it's overlapping and which it isn't?
I've fixed this by setting a delay variable on the Room Spawner - any time it's lower than 5, it'll add 1 until 5 is reached. Every time the player leaves a room, this variable is reset to 0.
I then tweaked all the overlapping events to that they only occur when the variable is set to 5, this way the code has a 5 frame delay to destroy any enemies which aren't being overlapped and establish which ones are, and the whole process seems to work pretty smoothly?
It also makes me think about old games like the original Zelda and Golden Axe Warrior, how whenever you enter a new room/screen the enemies aren't present immediately, and arrive a second later in a puff of smoke - it makes me wonder if they were using the same sort of approach, driven by similar issues?
A bit wordy I know, but I wanted to explain my process as thoroughly as possible for others who may be having a similar issue, and for more experienced coders to scrutinise and improve upon if they have any advice.