Enemy won't follow me

Godot version I use v4.4.1.stable.official

I wanted to start learning how to create games and wanted to start with an game like Vampire Survivor and looked up tutorials for the enemy movement. whenever i preview my test scene the enemy wont follow me he is just walking where i walk and he ist lagging and when i stop move he also stops i followed exactly 3 different tutorials and don’t know what to do.

here the code i used from the tutorials:

Hi!

Your code seems fine to me, but the issue is that the enemy node is a child of the player node, meaning that whenever the player moves, it will make the enemy move too (since child positions are affected by their parent). You could try with using global_position instead of position, for both the player reference and the enemy itself (as it will use the global position in world instead of the local position of the nodes in their tree hierarchy), but you should also make the player and the enemies both children of the same node (TestScene in your case).

1 Like

Oh I see it now thank you very much

1 Like