Updated enemy controller
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user