From d012e9f5acb17a829022152d6634be1792a009a3 Mon Sep 17 00:00:00 2001 From: Haze Weathers Date: Wed, 22 Mar 2023 02:07:43 -0400 Subject: [PATCH] make hatch mildly more stable --- objects/player/player.gd | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/objects/player/player.gd b/objects/player/player.gd index a304bb8..2bd1fc1 100644 --- a/objects/player/player.gd +++ b/objects/player/player.gd @@ -30,6 +30,7 @@ onready var map = get_owner() enum State {IDLE,WALK,JUMP,FALL,STUNNED,CLIMB,SWORD,SHOOT,INACTIVE,TRANSPORT,HATCH} var current_state = State.IDLE var can_die = true +var dead = false ##Runtime var axis = Vector2.ZERO #Current direction being held var trail_color = Color(0.25,0,1,0.4) @@ -312,6 +313,8 @@ func exit_transport(): current_state = State.FALL func enter_hatch(snap_position): + if dead: + return position = snap_position current_state = State.INACTIVE hitbox.disabled = true @@ -319,11 +322,12 @@ func enter_hatch(snap_position): anims.play("enter hatch", -1, 1.25) func die(): + #If the player is already dead, don't kill them again + if current_state == State.INACTIVE or current_state == State.HATCH: + return if can_die: + dead = true Audio.ac_climb.set_stream(null) # stop climbing sound\ - #If the player is already dead, don't kill them again - if current_state == State.INACTIVE: - return #Create particles var new_particles = death_particles.duplicate() get_parent().add_child(new_particles) @@ -363,6 +367,7 @@ func die(): #Respawn player current_state = State.IDLE sprite.visible = true + dead = false func _on_AnimationPlayer_animation_finished(anim_name): #Set hatch state @@ -375,6 +380,7 @@ func _on_AnimationPlayer_animation_finished(anim_name): current_state = State.IDLE hitbox.disabled = false collision_layer = 2 + return if current_state == State.INACTIVE: return #Return to idle after slash