Pet pathfinding moving on it's own when my scene starts

So I’m new to godot and wanted to make a simple targeting system for a pet. I wanted the pet to follow the player. I got the code working to where the pet actually follows the player’s movement, but when I run the scene, the pet always moves down-right for a set distance and then stays there and acts like it’s next to the player. I’ve tried to move the nodes around in their respective scenes, but no matter what I do the pet always moves in the same direction for the same distance.
Here’s the code for the targeting:

Your character’s global_position is where the CharacterBody2D is; you may have moved the visual AnimatedSprite2D offset from the CharacterBody2D so the parent character body moves close to the other player, then the child sprite moves offset from that. Setting your AnimatedSprite2D’s position to 0,0 should help

Here’s a video of what it does: https://drive.google.com/file/d/1ii2Rmb3OtkqBwuSJlNCsf-46FuYeLjgq/view?usp=drive_link

I’ve tried setting the position of all nodes child/parent to zero and it still moves in the same direction

You are dragging the AnimatedSprite2D, not the CharacterBody2D. Notice how you are only changing the offset not the distance, set the dog’s AnimatedSprite2D to the origin 0,0; then you can change the CharacterBody2D’s position to accurately reflect it’s starting position.

Thank you so much🙏 I didnt’ even notice that they were two separate things

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.