I need help with an enemy Pathfinding Ai

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Jg Coder

I need help with pathfinding. This is my “Chase the Player” Script . But I have walls in my demo so I need some help making a path finding script with this as a base. I don’t have a tilemap right now so keep that in mind.

extends KinematicBody2D

var velocity = Vector2.ZERO
var player = null
var speed = 250
func _physics_process(delta):
player = get_parent().get_node(“Player”)
velocity = Vector2.ZERO
velocity = (player.position - position).normalized() * speed

velocity = move_and_slide(velocity)
:bust_in_silhouette: Reply From: Inces

This cant be called base, pathfinding is far more complicated. There are a lot of options to implement pathfinding. Easiest is navigation node, but it will only work when walls don’t change in gametime. A little harder to learn is Astar, this one is most common and basic for all kinds of games. Finally there is Vector Field, which is type of pathfinding optimized for large amounts of units, like in RTS games. Noone is able to make pathfinding script for You here, You have to google these 3 pathfinding methods and learn some.