edge anim!

This commit is contained in:
pennyrigate 2023-06-22 16:19:57 -04:00
parent 9439d0313c
commit 70fdeff1ca
2 changed files with 83 additions and 1 deletions

View file

@ -53,6 +53,7 @@ onready var death_splatter_position: Position2D = $"%DeathSplatterPosition"
onready var pushable_detector: RayCast2D = $"%PushableDetector"
onready var oxygen_timer = $OxygenTimer
onready var low_oxygen_label = $LowOxygenLabel
onready var edge_detector = $Graphics/EdgeDetector
# OVERRIDES #
func _ready() -> void:
@ -257,12 +258,17 @@ func _on_Respawn_state_entered() -> void:
graphics.visible = true
state_chart.call_deferred("send_event", "get_real")
func _on_Edge_state_entered():
animation_player.play("edge")
# STATE PROCESSING #
## when on ground
func _process_grounded(delta: float) -> void:
# make sure is_on_floor detected still
velocity.y = 1.0
#play edge sprite if hanging of edge
if !edge_detector.is_colliding():
state_chart.send_event("edge")
## called when player can move left and rightpass # Repass # Rpass # Replace with function body.eplace with function body.place with function body.
func _process_horizontal_movement(delta: float) -> void:
@ -395,3 +401,5 @@ func _on_Ducking_event_received(event):
func _on_OxygenTimer_timeout():
if underwater: die()