if global.target_door_id != -1
{
	with(oDoor)
	{
        if door_id == global.target_door_id
		{
            other.x = x;
            other.y = y;
			global.door_direction = door_direction;
        }
    }
	state = state_exit_door;
	enter_room_timer = enter_room_timer_max;
	switch(global.door_direction)
	{
		case "LEFT":
			facing = -1;
			x_spd = facing * walk_spd;
			y_spd = 0;
			set_sprite(sPlayerWalk);
			break;
		case "RIGHT":
			facing = 1;
			x_spd = facing * walk_spd;
			y_spd = 0;
			set_sprite(sPlayerWalk);
			break;
		case "UP":
			y_spd = 0.6 * jump_spd;
			enter_room_timer = enter_room_timer_max * 0.5;
			break;
		case "DOWN":
			enter_room_timer = enter_room_timer_max * 0.5;
	}
}
else
{
	x = global.save_data.world.spxPos;
	y = global.save_data.world.spyPos;
}
global.camera.smooth = 0.1;
global.camera.follow = self;
camera_snap();
	
if global.save_data.player.corpse.targetRoom == room
	icl(oPlayerCorpse,
	global.save_data.player.corpse.xPos,
	global.save_data.player.corpse.yPos);