Mekire wrote:Well technically if you want to do it properly you are going to have to learn the A* algorithm.
I just posted an update to my astar study in Completed Scripts here:
[pygame] A* pathfinding demo
You could also try using a library. I have had NetworkX recommended to me as a decent solution. This will however create another dependency for your game making it more trouble for users to run.
1. find the directions that reduce distance between player and enemy.
2. test if these directions are unoccupied by obstacles.
3. If a tested cell is unoccupied then move in that direction;
else pick a direction that doesn't bring you closer and move that way.
Users browsing this forum: No registered users and 1 guest