Tune and optimize boss encounter
This commit is contained in:
parent
40f284dcdd
commit
68985316e5
16 changed files with 316 additions and 88 deletions
|
|
@ -4,6 +4,7 @@ extends Node2D
|
|||
@onready var boss: Node2D = $Boss
|
||||
@onready var status_label: Label = $EncounterUI/StatusLabel
|
||||
@onready var hint_label: Label = $EncounterUI/HintLabel
|
||||
@onready var health_bar: ProgressBar = $EncounterUI/HealthBar
|
||||
@onready var game_state: Node = get_node("/root/GameState")
|
||||
|
||||
|
||||
|
|
@ -15,15 +16,20 @@ func _ready() -> void:
|
|||
game_state.planet_definition_id)
|
||||
if game_state.is_planet_conquered(game_state.planet_id):
|
||||
boss.suppress_as_defeated()
|
||||
health_bar.max_value = boss.max_health()
|
||||
health_bar.value = 0
|
||||
status_label.text = "THE WARDEN IS DEAD"
|
||||
hint_label.text = ""
|
||||
return
|
||||
boss.defeated.connect(_on_boss_defeated)
|
||||
boss.phase_changed.connect(_on_boss_phase_changed)
|
||||
boss.health_changed.connect(_on_boss_health_changed)
|
||||
health_bar.max_value = boss.max_health()
|
||||
health_bar.value = boss.current_health()
|
||||
_refresh_status()
|
||||
|
||||
|
||||
func _process(_delta: float) -> void:
|
||||
if not is_instance_valid(boss) or boss.phase == boss.Phase.DEFEATED:
|
||||
return
|
||||
func _refresh_status() -> void:
|
||||
var phase_name: String = "PHASE II · LASER STORM" \
|
||||
if boss.phase == boss.Phase.LASER_STORM else "PHASE I · HATCHLINGS"
|
||||
status_label.text = "THE WARDEN · %s · EYES %d/%d" % [
|
||||
|
|
@ -31,7 +37,19 @@ func _process(_delta: float) -> void:
|
|||
hint_label.text = "DESTROY GOLDEN HATCHLINGS · FOLLOW THEIR LIGHT · BREAK THE OPEN EYES"
|
||||
|
||||
|
||||
func _on_boss_phase_changed(_phase: int) -> void:
|
||||
if boss.phase != boss.Phase.DEFEATED:
|
||||
_refresh_status()
|
||||
|
||||
|
||||
func _on_boss_health_changed(current: int, maximum: int) -> void:
|
||||
health_bar.max_value = maximum
|
||||
health_bar.value = current
|
||||
_refresh_status()
|
||||
|
||||
|
||||
func _on_boss_defeated() -> void:
|
||||
game_state.mark_point_captured(game_state.planet_id, 0)
|
||||
health_bar.value = 0
|
||||
status_label.text = "THE WARDEN IS DEAD · PLANET CONQUERED"
|
||||
hint_label.text = ""
|
||||
|
|
|
|||
Loading…
Reference in a new issue