fix lives going below 0 with game over

This commit is contained in:
Haze Weathers 2023-02-06 15:52:17 -05:00
parent 4120529a53
commit fee4411562

View file

@ -302,8 +302,7 @@ func die():
sprite.visible = false
current_state = State.INACTIVE
position = Game.respawn_point
Game.lives -= 1
if Game.lives < 0:
if Game.lives <= 0:
new_particles.amount = 64
new_particles.lifetime = 0.45
new_particles.speed_scale = 1.5
@ -316,6 +315,7 @@ func die():
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
Game.call_deferred("restart_level")
else:
Game.lives -= 1
Game.play_sound(Game.a_die, Game.ac_die)
yield(Game.freeze_frame(0.3), "timeout")
current_state = State.IDLE