+1 vote

Hello! Is there any simple way to make an enemy KinematicBody2D follow the player and make it so he doesn't get stuck at a wall, and just finds his way around?

(Ex: An overhead game with a zombie, and the zombie follows the player and when he reaches a wall, just goes around it?)

Some help/Ideas would be nice.

in Engine by (23 points)

1 Answer

0 votes

There is Navigation2D and NavigationPolygonInstance for finding path.

https://github.com/godotengine/godot-demo-projects/tree/2.1/2d/navpoly
here is sample project.

you can find it also on download page. https://godotengine.org/download
Download "Demos and Examples" and import demo/2d/navpoly

by (9,760 points)

I'd like to add the OP also check out the Kinematic Body tutorial to deal with sticking to the walls of the enemies happen to run into them.

Kinematic Body Tutorial

On a top down view, how do I get the Zombie sprite to have it's arms move to the player? Having a hard time getting the sprite to rotate to the direction of the player as I'm trying to make a top-down shooter. enter image description here

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 Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.