Updated enemy controller

This commit is contained in:
2025-11-25 16:52:12 +03:00
parent b4529a407b
commit 0d2eab4e0a
6 changed files with 37 additions and 4 deletions
@@ -31,3 +31,6 @@ max_hull = 200
[node name="HeathBar" parent="." index="3"]
offset_top = 30.0
offset_bottom = 30.0
[node name="VisibleOnScreenNotifier2D" parent="." index="5"]
rect = Rect2(-29, -21, 58, 42)
@@ -30,3 +30,6 @@ max_hull = 100
[node name="HeathBar" parent="." index="3"]
offset_top = 30.0
offset_bottom = 30.0
[node name="VisibleOnScreenNotifier2D" parent="." index="5"]
rect = Rect2(-13, -21, 26, 42)
@@ -30,3 +30,6 @@ max_hull = 50
[node name="HeathBar" parent="." index="3"]
offset_top = 14.0
offset_bottom = 14.0
[node name="VisibleOnScreenNotifier2D" parent="." index="5"]
rect = Rect2(-13, -5, 26, 10)
@@ -45,6 +45,10 @@ func _apply_homing_guidance(delta: float) -> void:
func _update_sprite(velocity: Vector2) -> void:
if velocity.is_zero_approx():
sprites[0].show()
return
var sector := TAU / sprites.size()
var angle := velocity.angle()
var bisector := angle + sector * 0.5