forked from team-sg/hero-mark-2
fix lives going below 0 with game over
This commit is contained in:
parent
4120529a53
commit
fee4411562
1 changed files with 2 additions and 2 deletions
|
@ -302,8 +302,7 @@ func die():
|
||||||
sprite.visible = false
|
sprite.visible = false
|
||||||
current_state = State.INACTIVE
|
current_state = State.INACTIVE
|
||||||
position = Game.respawn_point
|
position = Game.respawn_point
|
||||||
Game.lives -= 1
|
if Game.lives <= 0:
|
||||||
if Game.lives < 0:
|
|
||||||
new_particles.amount = 64
|
new_particles.amount = 64
|
||||||
new_particles.lifetime = 0.45
|
new_particles.lifetime = 0.45
|
||||||
new_particles.speed_scale = 1.5
|
new_particles.speed_scale = 1.5
|
||||||
|
@ -316,6 +315,7 @@ func die():
|
||||||
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
|
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
|
||||||
Game.call_deferred("restart_level")
|
Game.call_deferred("restart_level")
|
||||||
else:
|
else:
|
||||||
|
Game.lives -= 1
|
||||||
Game.play_sound(Game.a_die, Game.ac_die)
|
Game.play_sound(Game.a_die, Game.ac_die)
|
||||||
yield(Game.freeze_frame(0.3), "timeout")
|
yield(Game.freeze_frame(0.3), "timeout")
|
||||||
current_state = State.IDLE
|
current_state = State.IDLE
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue