I’m trying to make enemies follow the player on a 2D Top Down on two diffrent projects, on the first it worked but It ran away from the player while on the second it didn’t work at all
My current code:
extends CharacterBody2D
var speed = 7
var player_chase = false
var player = null
func _physics_process(delta):
if player_chase:
position += (player.position - position)/speed
func _on_detection_area_body_entered(body):
player = body
player_chase = true
func _on_detection_area_exited(body):
player = null
player_chase = false
That wasn’t the solution though.
Use your old code and try resetting the sprite and collision transform.position of both the player and enemy scene to 0.0
The Player’s X and Y were already on 0 while the Enemy had X on 0 and y on 0.5
I set it to 0 but nothing changed and the enemy still isnt following the player