T
Tidbit
Guest
Hello there, I've been fiddling with a roguelike for the past few days and opted into using GM's built in path functions to avoid having to mess around with writing a pathfinding system myself.
My RL has 8 direction movement and the player can cross over blocked corners but it seems as though GM's built in pathfinding is unable to.
Here are some screenshots showing whats going on with the path:
Before crossing a blocked corner:
After crossing blocked corner:
As you can see, after crossing through the blocked corner, the built in mp_ functions GM provides are no longer able to path to the minotaur.
This is less than ideal since normally the enemies should be able move according to the same way a player is able to.
I'm generating the grid in the way that you would expect but since I'm working with a turn based system, I'm handing the movement a bit differently in a script that the enemy calls when its turn is up:
I've done a sizeable amount of digging through other threads and wasn't able to specifically find anything relating to this sort of issue so I'm hoping there's a way I can bend the rules without having to take the time to write something up from scratch.
I was thinking about perhaps checking for when the player crosses between corners and create an instance which would become the new target for the currently seeking enemy. When the enemy reached it, the other instance would have stored in it which diagonal the player traveled and would then have the enemy perform that as its next movement direction. Then the enemy would be able to resume standard pathfinding like before.
This would be probably the simplest option but I wanted to see if anyone else had any better ideas or perhaps solutions which would allow me to enhance the current suite of mp_ commands to allow for this sort of movement.
Thanks in advance for the help!
My RL has 8 direction movement and the player can cross over blocked corners but it seems as though GM's built in pathfinding is unable to.
Here are some screenshots showing whats going on with the path:
Before crossing a blocked corner:
After crossing blocked corner:
As you can see, after crossing through the blocked corner, the built in mp_ functions GM provides are no longer able to path to the minotaur.
This is less than ideal since normally the enemies should be able move according to the same way a player is able to.
I'm generating the grid in the way that you would expect but since I'm working with a turn based system, I'm handing the movement a bit differently in a script that the enemy calls when its turn is up:
Code:
var dir, components, dx, dy, _id;
dir = argument0;
_id = 0;
components = global.components[dir];
dx = components[0];
dy = components[1];
_id = instance_place(x+16*dx, y+16*dy, oPlayer)
if (_id = noone) {
if (mp_grid_path(pGrid.map_grid, path, x,y,target.x ,target.y, 0)) {
target_x = path_get_point_x(path, path_step);
target_y = path_get_point_y(path, path_step);
x_pos = target_x div tile_width;
y_pos = target_y div tile_height;
}
}
I was thinking about perhaps checking for when the player crosses between corners and create an instance which would become the new target for the currently seeking enemy. When the enemy reached it, the other instance would have stored in it which diagonal the player traveled and would then have the enemy perform that as its next movement direction. Then the enemy would be able to resume standard pathfinding like before.
This would be probably the simplest option but I wanted to see if anyone else had any better ideas or perhaps solutions which would allow me to enhance the current suite of mp_ commands to allow for this sort of movement.
Thanks in advance for the help!