hi,
i make my beat them all game in 3d with 2d sprite, it's more easy for collision and jump but i got 2 problems because i tyry to recycle scriptsd who works on 2D and a problem with global_position.
1 - enemy go towards player
#ennemy goes to player
func _physics_process(delta):
if target:
var velocity = global_position.direction_to(target.global_position)
move_and_collide(velocity * SPEED * delta)
if animation == false:
$AnimatedSprite3D.play("Walk")
for detection
#ennemy detect player
func _on_detection_body_entered(body):
target = body
func _on_detection_body_exited(body):
target = null
it didn't work π can you help me ?
2 - second problem, i want to make a flip en sprite enemy :
#flip H ennemy, ennemy turn towards the player
if global_position.x >= target.global_position.x :
$AnimatedSprite3D.flip_h = false
if global_position.x <= target.global_position.x :
$AnimatedSprite3D.flip_h = true
can you help me too ?
thx
cya