make hatch mildly more stable
This commit is contained in:
parent
0a5c111615
commit
d012e9f5ac
1 changed files with 9 additions and 3 deletions
|
@ -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 can_die:
|
||||
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:
|
||||
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\
|
||||
#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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue