Hi all!
FOR THOSE LOOKING FOR THE SOLUTION FOR MY SPECIFIC PROBLEM:
Sorry for the thread, but i figure if i can save someone else the pain I should leave it
the path2d should start with a transform of 0, 0
that was my problem :expressionless:
anyway. original thread left up for claritys sake:
i've been trying to learn Godot lately, and I've hit a problem that i don't quite understand and am having trouble solving myself
I was trying to quickly get my enemy to have a state machine, but the patrol route function I'm doing doesn't seem to be working quite right.
I've been following some of the tutorials from kidscancode godot recipes, I'll link the one I was using for pathfinding.
Link : here
the behavior I"m having right now involves that the enemy will chase the player when the player is in radius, but it seems to think the patrol route takes it to one side of the wall, and it gets stuck there.
I know I should understand the function better... I've looked up wrapi and I can't seem to find much on it. So maybe I should use something else?
Here's the code just in the patrol function:
func patrol_route():
if !patrol_path:
print("hi i didn't find the patrol path")
return
var target = patrol_points[patrol_index]
if position.distance_to(target) < 1:
patrol_index = wrapi(patrol_index + 1, 0, patrol_points.size())
target = patrol_points[patrol_index]
velocity = (target - position).normalized() * speed
velocity = move_and_slide(velocity)
The whole code file is attached, if that will help
and here's the screencap of my set up in the scene im testing:

hoping for anyone's advice, thanks for reading and have a good day!