S
Satori
Guest
My top-down game uses procedurally generated levels, and I use the function mp_linear_path_object() after the map is completed to make sure there is a clear path to the exit. In theory, this function should return true if a path is found and false if it isn't. My problem is that in rare instances the function will return true even if the path is completely blocked.
Here is the code I use in a user event of obj_player:
This checks for a path between the player's starting location and a spot just in front of the stairs. If the path is blocked, it erases the random seed for the level and starts over. But as I said, sometimes it returns true even when the path is blocked.
Am I doing something wrong, or is this a bug in the function? Is there a better way to do this?
Here is the code I use in a user event of obj_player:
Code:
if !mp_linear_path_object(path0, global.strdn.x+64, global.strdn.y+260, 2000, obj_wallblock)
{
global.flrseeds[global.flr] = 0; // Erase random seed
room_restart();
}
Am I doing something wrong, or is this a bug in the function? Is there a better way to do this?