the boss!
This commit is contained in:
parent
1e618d8cd4
commit
abd45d7d64
14 changed files with 445 additions and 2 deletions
34
systems/boss/boss.gd
Normal file
34
systems/boss/boss.gd
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
class_name Boss
|
||||
extends Node2D
|
||||
|
||||
|
||||
signal damaged(damage: int)
|
||||
signal defeated()
|
||||
|
||||
|
||||
@export var first_phase: BossPhase
|
||||
|
||||
|
||||
var current_phase: BossPhase
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if first_phase:
|
||||
current_phase = first_phase
|
||||
current_phase.ended.connect(_on_phase_ended, CONNECT_ONE_SHOT)
|
||||
first_phase.start_phase()
|
||||
|
||||
|
||||
func hurt(damage: int = 1) -> void:
|
||||
if current_phase:
|
||||
CurrentGame.change_score(100)
|
||||
current_phase.hurt(damage)
|
||||
damaged.emit(damage)
|
||||
|
||||
|
||||
func _on_phase_ended() -> void:
|
||||
current_phase = current_phase.next_phase
|
||||
if current_phase:
|
||||
current_phase.ended.connect(_on_phase_ended, CONNECT_ONE_SHOT)
|
||||
else:
|
||||
defeated.emit()
|
||||
Loading…
Add table
Add a link
Reference in a new issue