0 votes

I'm trying to get an enemy to navigate a tile map using navigation and follow path/path2d nodes. I've looked at some tutorials and most showed other methods that I didn't fully understand. I'm getting the path with getsimplepath() and trying to set the points from that array to the path2d if this is impossible could someone give me a bit help in this matter. My tile map does have navigation tiles debug does prove this. Here is what I'm using currently.

var path = $Navigation2D.get_simple_path($Enemy.position,$Player.position)
if($Enemy.get_curve().get_point_count() == 0):
    for x in path:
        $Enemy.get_curve().add_point(x)
print($Enemy.get_curve().get_point_count())
$Enemy/PathFollow2D.offset += 1

Thanks ahead of time if you could help!

in Engine by (61 points)

Are you updated the PathFollow2D over time?
Also, it's only the follow children which will move with it, not the Path2D itself

The path follow is being updated and the object I’m trying to move is a child of the path 2D not the node itself. The main problem is trying to get the points from the getsimplepath to the path2D via script

Please log in or register to answer this question.

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.