more finalboss workd
This commit is contained in:
parent
63b24cb614
commit
5b520f0a46
5 changed files with 87 additions and 26 deletions
|
@ -4,19 +4,27 @@ extends Node2D
|
|||
export var push_speed: float = 60.0
|
||||
export var chase_speed: float = 40.0
|
||||
export var breath_dps: float = 50.0
|
||||
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 sg2083_path: NodePath
|
||||
|
||||
|
||||
onready var animation_player: AnimationPlayer = $"%AnimationPlayer"
|
||||
onready var state_chart: Node = $StateChart
|
||||
onready var state_chart: StateChart = $StateChart
|
||||
onready var in_range_cast: RayCast2D = $InRangeCast
|
||||
onready var out_range_cast: RayCast2D = $OutRangeCast
|
||||
onready var shoot_range_cast: RayCast2D = $ShootRangeCast
|
||||
|
||||
|
||||
func _physics_process(delta: float) -> void:
|
||||
var sg2083 := get_node(sg2083_path)
|
||||
if sg2083 and sg2083.state == 0:
|
||||
state_chart.set_guard_property("player_dead", true)
|
||||
state_chart.send_event("player_dead")
|
||||
else:
|
||||
state_chart.set_guard_property("player_dead", false)
|
||||
if not out_range_cast.is_colliding():
|
||||
state_chart.send_event("out_of_range")
|
||||
elif in_range_cast.is_colliding():
|
||||
|
@ -35,6 +43,7 @@ func _attack() -> void:
|
|||
var sg2083 := get_node(sg2083_path)
|
||||
if sg2083.has_method("hurt"):
|
||||
sg2083.hurt(punch_damage)
|
||||
sg2083.knock_back(punch_knockback)
|
||||
|
||||
|
||||
func _on_Roar_state_entered() -> void:
|
||||
|
@ -85,3 +94,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue