fixed issue where the closer the enemies get to the with the slower they become

pull/7/head
Jaro Winkelhausen 2026-04-15 17:57:14 +02:00
parent 6a2b122343
commit 8ade948ab2
4 changed files with 4 additions and 5 deletions

View File

@ -3,7 +3,7 @@ extends EnemyBase
func _ready() -> void:
super()
speed = 0.1
speed = 15.0
hits_remaining = 2
$Area2D.body_entered.connect(_on_area_2d_body_entered)

View File

@ -67,11 +67,10 @@ func _process(delta: float) -> void:
pass
func _chase_witch() -> void:
var direction = Vector2(witch.global_position - global_position)
var direction = Vector2(witch.global_position - global_position).normalized()
if direction != Vector2.ZERO:
last_direction = direction
velocity = direction * speed
velocity = direction * speed
if direction == Vector2.ZERO:
animated_sprite_2d.play("idle")

View File

@ -3,7 +3,7 @@ extends EnemyBase
func _ready() -> void:
super()
speed = 0.1
speed = 15.0
hits_remaining = 3
$Area2D.body_entered.connect(_on_area_2d_body_entered)

View File

@ -6,7 +6,7 @@ extends EnemyBase
# Called every frame. 'delta' is the elapsed time since the previous frame.+
func _ready() -> void:
super()
speed = 0.1
speed = 15.0
func _process(delta: float) -> void:
if is_dying: