2d Enemy AI Pathfinding (Need Help)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By combatcrotch
:warning: Old Version Published before Godot 3 was released.

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 get_simple_path properly so the AI follows the player avoiding collisions I would be very greatful.

:bust_in_silhouette: Reply From: haz

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