famira can die
This commit is contained in:
parent
5b520f0a46
commit
1274e989b4
3 changed files with 200 additions and 9 deletions
|
@ -8,6 +8,8 @@ export var breath_knockback: float = 16.0
|
|||
export var punch_damage: float = 10.0
|
||||
export var punch_knockback: float = 8.0
|
||||
export var hurting: bool = false
|
||||
export var hp: float = 100.0
|
||||
export var sg2083_beam_dps: float = 10.0
|
||||
export var sg2083_path: NodePath
|
||||
|
||||
|
||||
|
@ -39,6 +41,12 @@ func stop_push() -> void:
|
|||
state_chart.send_event("stop_push")
|
||||
|
||||
|
||||
func hurt(amount: float) -> void:
|
||||
hp -= amount
|
||||
if hp <= 0.0:
|
||||
state_chart.send_event("die")
|
||||
|
||||
|
||||
func _attack() -> void:
|
||||
var sg2083 := get_node(sg2083_path)
|
||||
if sg2083.has_method("hurt"):
|
||||
|
@ -48,6 +56,9 @@ func _attack() -> void:
|
|||
|
||||
func _on_Roar_state_entered() -> void:
|
||||
animation_player.play("roar", 0.25)
|
||||
|
||||
|
||||
func _roar() -> void:
|
||||
Audio.play_sound(Audio.a_famira, Audio.ac_boss)
|
||||
|
||||
|
||||
|
@ -72,11 +83,8 @@ func _on_PushedBack_state_entered() -> void:
|
|||
|
||||
|
||||
func _on_Dying_state_entered() -> void:
|
||||
queue_free()
|
||||
|
||||
|
||||
func _on_PushedBack_event_received(event) -> void:
|
||||
print(event)
|
||||
animation_player.play("die", 0.25)
|
||||
_roar()
|
||||
|
||||
|
||||
func _on_Chasing_state_physics_processing(delta) -> void:
|
||||
|
@ -84,6 +92,7 @@ func _on_Chasing_state_physics_processing(delta) -> void:
|
|||
|
||||
|
||||
func _on_PushedBack_state_physics_processing(delta) -> void:
|
||||
hurt(sg2083_beam_dps * delta)
|
||||
position.x += push_speed * delta
|
||||
|
||||
|
||||
|
@ -94,4 +103,4 @@ func _on_Shooting_state_physics_processing(delta) -> void:
|
|||
var distance := shoot_range_cast.to_local(shoot_range_cast.get_collision_point()).x
|
||||
var weight := inverse_lerp(shoot_range_cast.cast_to.x, 0.0, distance)
|
||||
sg2083.hurt(breath_dps * weight * delta, true)
|
||||
sg2083.knock_back(breath_knockback * weight * delta)
|
||||
sg2083.knock_back(breath_knockback * weight * delta, true)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue