![]() |
Attention | Topic was automatically imported from the old Question2Answer platform. |
![]() |
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)