#Enemy moves despite the code saying its not allowed to
4 messages · Page 1 of 1 (latest)
check, that the area you entered is actually the one attached to the player, not another one. That's my guess on what's happening there
If you are using a TileMap with collision then it could be that the enemy is detecting that and then moving towards its origin.
If your enemy is reacting to another body other than the player, one way to fix it would be to give your player's CharacterBody2D a unique collision layer and then change the collision mask of the enemy's Area2D to be the same, so it is only checking for when the player enters it.
Insert print(body.name) at line 12 to see which body triggers it