+2 votes

Just started using Godot and I have a very basic understanding of how to code in it. Right now I have a 2d top down game I am working on and I am having trouble with the enemy AI.

I have looked up countless videos about pathfinding and I cant figure out how to get what I want to happen work.

Currently my enemy will roam about on his own freely. When the player steps in the collision area of the enemy I had some code setup to where the enemy would then chase the player. That was great but I need to get that code to work with pathfinding so the enemy does not collide with walls and will step around them.

I now have a tile map setup with flooring that has a Navigationpolygon instance on it. and in the main scene it is a child of a Navigation2d

If anyone could help explain how to use getsimplepath properly so the AI follows the player avoiding collisions I would be very greatful.

asked Jul 8, 2017 in Engine by combatcrotch (14 points)

1 Answer

+1 vote

KidsCanCode made a great tutorial for this. I believe he describes exactly what your are looking for in detail:

answered Jul 14, 2017 by haz (26 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.