Hi,
im currently working on a little roguelike/rpg game, movement is grid and turnbased, means if you or an npc walk 1 tile it costs 1 actionpoint.
So that the NPCs dont run over obstacles like walls and trees i tryed building a simple pathfinding system, like "if way on x axis blocked "->"try walking 1 tile in y direction" and so on, but im running into problems, like when the NPC is standing in an dead end.
does anyone know an easy algorythm for that problem?
Thanks!
heres what i got so far, its not very clean but i hope readable, im trying to get it to work first and then clean up and optimize
the events dont show every condition but there are basically three more for NPC.x>player.x and the same for y directions.
The NPC always trys to first match the players x position and then y, and maybe that start is already wrong ^^