• Hey Guest! Ever feel like entering a Game Jam, but the time limit is always too much pressure? We get it... You lead a hectic life and dedicating 3 whole days to make a game just doesn't work for you! So, why not enter the GMC SLOW JAM? Take your time! Kick back and make your game over 4 months! Interested? Then just click here!

Legacy GM Enemy Re spawning Error

R

Royal Den Studios

Guest
Hello there,
I am working on a system to re-spawn enemies in presistant rooms. Basically you can kill all enemies inside the current room and if you were to leave it and come back, the enemies would not be there.
(Current Room) < (Previous Room) < (2nd to Last Room)

Assuming all enemies have been killed in all 3 rooms, if the player goes from the Current Room to Previous Room then no enemy should re-spawn. But if the Player goes from Current Room to Previous then to 2nd to Last Room THEN the enemies should re-spawn.

For some reason my code isn't really processing this idea correctly. Hopefully you guys can see something that I don't?

ALL ROOMS ARE PRESISTANT

HTML:
//Player Create (He is Presistant)
global.LastRoom


//Warp Collision With Player
///Warp Player
room_goto(WarpRoom)
Obj_Player.x = WarpX
Obj_Player.y = WarpY
global.LastRoom = room


//Enemy Spawner Room Start
if (global.LastRoom = room)
    { if (instance_exists(Obj_Enemy_Parent))
        { with(Obj_Enemy_Parent)
            { instance_destroy()
            }
        }
    alarm[0] = 1
    }


//Enemy Spawner Alarm[0]
///Create Enemy
instance_create(x,y,Obj_Basic_AI)
 
Top