LostLevelsEnding.gd 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. extends Level
  2. var can_exit := false
  3. var seen := false
  4. func _enter_tree() -> void:
  5. update_next_level_info()
  6. seen = Global.game_beaten
  7. Global.game_beaten = true
  8. Global.can_time_tick = false
  9. Global.current_level = self
  10. if Global.world_num > 8:
  11. Global.extra_worlds_win = true
  12. update_theme()
  13. Global.current_campaign = campaign
  14. func _ready() -> void:
  15. AudioManager.set_music_override(AudioManager.MUSIC_OVERRIDES.ENDING, 9999999, false)
  16. Global.can_time_tick = false
  17. SaveManager.visited_levels[SaveManager.get_level_idx(9, 1)] = "1"
  18. $Text2/Hero.text = tr("CUTSCENE_LL_PEACH_4" if Global.player_characters[0] != "3" else "CUTSCENE_LL_PEACH_4F")
  19. $Text2/Hurrah.text = tr("CUTSCENE_LL_PEACH_3").replace("{PLAYER}", tr(Player.CHARACTER_NAMES[int(Global.player_characters[0])]))
  20. $ThankYou.text = tr("CUTSCENE_CASTLE_PEACH_1").replace("{PLAYER}", tr(Player.CHARACTER_NAMES[int(Global.player_characters[0])]))
  21. func _process(_delta: float) -> void:
  22. if can_exit and Input.is_action_just_pressed("jump_0"):
  23. SaveManager.write_save()
  24. if seen or Global.current_campaign == "SMBANN" or Global.world_num > 8 or Global.current_game_mode != Global.GameMode.CAMPAIGN:
  25. Global.transition_to_scene("res://Scenes/Levels/TitleScreen.tscn")
  26. else:
  27. CreditsLevel.go_to_title_screen = false
  28. Global.transition_to_scene("res://Scenes/Levels/Credits.tscn")
  29. $LevelBG.combo_progress = 1
  30. DiscoLevel.can_meter_tick = false
  31. func tally_score() -> void:
  32. add_lives_to_score()
  33. func add_lives_to_score() -> void:
  34. for i in Global.lives:
  35. AudioManager.play_global_sfx("1_up")
  36. Global.score += 100000
  37. await get_tree().create_timer(0.5, false).timeout
  38. func show_toads() -> void:
  39. for i in $Toads.get_children():
  40. i.show()
  41. AudioManager.play_global_sfx("coin")
  42. await get_tree().create_timer(0.7, false).timeout
  43. await get_tree().create_timer(1, false).timeout
  44. can_exit = true