forked from team-sg/hero-mark-2
fix INACTIVE state in player
This commit is contained in:
parent
343151ebdf
commit
d57194597e
1 changed files with 6 additions and 2 deletions
|
@ -38,12 +38,12 @@ func _ready():
|
||||||
Game.respawn_point = global_position
|
Game.respawn_point = global_position
|
||||||
|
|
||||||
func _physics_process(delta):
|
func _physics_process(delta):
|
||||||
|
if current_state == State.INACTIVE:
|
||||||
|
return
|
||||||
axis = Vector2(Input.get_axis("ui_left","ui_right"),Input.get_axis("ui_up","ui_down"))
|
axis = Vector2(Input.get_axis("ui_left","ui_right"),Input.get_axis("ui_up","ui_down"))
|
||||||
#Check ladder
|
#Check ladder
|
||||||
check_ladder()
|
check_ladder()
|
||||||
match current_state:
|
match current_state:
|
||||||
State.INACTIVE:
|
|
||||||
return
|
|
||||||
State.IDLE:
|
State.IDLE:
|
||||||
_process_idle()
|
_process_idle()
|
||||||
continue
|
continue
|
||||||
|
@ -270,6 +270,8 @@ func check_ladder():
|
||||||
#climb_ray.position.x = 4 * sprite.scale.x
|
#climb_ray.position.x = 4 * sprite.scale.x
|
||||||
|
|
||||||
func die():
|
func die():
|
||||||
|
if current_state == State.INACTIVE:
|
||||||
|
return
|
||||||
var new_particles = death_particles.duplicate()
|
var new_particles = death_particles.duplicate()
|
||||||
get_parent().add_child(new_particles)
|
get_parent().add_child(new_particles)
|
||||||
new_particles.global_position = global_position
|
new_particles.global_position = global_position
|
||||||
|
@ -296,6 +298,8 @@ func die():
|
||||||
sprite.visible = true
|
sprite.visible = true
|
||||||
|
|
||||||
func _on_AnimationPlayer_animation_finished(anim_name):
|
func _on_AnimationPlayer_animation_finished(anim_name):
|
||||||
|
if current_state == State.INACTIVE:
|
||||||
|
return
|
||||||
#Return to idle after slash
|
#Return to idle after slash
|
||||||
if anim_name == "stab":
|
if anim_name == "stab":
|
||||||
current_state = State.IDLE
|
current_state = State.IDLE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue