added infinite lives mode

This commit is contained in:
pennyrigate 2023-02-13 02:30:44 -05:00
parent f19a49f6e7
commit ed04bf1c2e
13 changed files with 109 additions and 11 deletions

View file

@ -296,32 +296,44 @@ func exit_transport():
current_state = State.FALL
func die():
Game.ac_climb.set_stream(null) # stop climbing sound
Game.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)
new_particles.global_position = global_position
new_particles.emitting = true
sprite.visible = false
current_state = State.INACTIVE
position = Game.respawn_point
if Game.lives <= 0:
current_state = State.INACTIVE # Set to state where player is not controllable
position = Game.respawn_point # Set respawn point
if Game.lives <= 0 && Game.use_lives:
#Gover
#Particles
new_particles.amount = 64
new_particles.lifetime = 0.45
new_particles.speed_scale = 1.5
current_state = State.INACTIVE
current_state = State.INACTIVE # Set to state where player is not controllable
Game.play_sound(Game.a_gover, Game.ac_die)
#Slow down time
var time_tween = get_tree().create_tween()
time_tween.tween_property(Engine, "time_scale", 0.1, 0.3)
Game.ac_music.stop()
yield(time_tween, "finished")
yield(time_tween, "finished") #Resume from freeze frame
yield(get_tree().create_timer(1.0 * 0.1), "timeout")
Game.call_deferred("restart_level")
else:
#Die
Game.lives -= 1
Game.deaths += 1
Game.play_sound(Game.a_die, Game.ac_die)
yield(Game.freeze_frame(0.3), "timeout")
#Reduce points if playing in infinite lives mode
if Game.use_lives == false && Game.lives < 0:
Game.score = max(0,Game.score - 500)
#Respawn player
current_state = State.IDLE
sprite.visible = true