J
jsipe2017
Guest
I am creating a game the requires the player to move around a dungeon-like level. When entering a room, I want the enemies in that room to attack the player. For code I have:
The only problem with this is that it makes the enemy chase the player no matter where in the GMS "room" it is in. When I made it so there was no way out of the room, the enemy went through the wall, and attacked my player. Would anybody be able to help me figure out a good code to help the enemy only attack the player when it enters a room within the game. I have been researching but I could only find the general map tracking algorithms.
GML:
path = path_add();
if (mp_grid_path(global.grid, path, x, y, obj_Player.x, obj_Player.y, 1))
{
path_start(path, 4, path_action_stop, false);
}
The only problem with this is that it makes the enemy chase the player no matter where in the GMS "room" it is in. When I made it so there was no way out of the room, the enemy went through the wall, and attacked my player. Would anybody be able to help me figure out a good code to help the enemy only attack the player when it enters a room within the game. I have been researching but I could only find the general map tracking algorithms.