menu stuff

This commit is contained in:
pennyrigate 2024-07-07 18:25:37 -04:00
parent 89df5eaca0
commit 3ad1b32492
6 changed files with 90 additions and 55 deletions

View file

@ -8,6 +8,7 @@ var selected_shard: int = 0
var tween: SceneTreeTween = null
var hop_tween: SceneTreeTween = null
var boss_shown: bool = false
var starting_level = false
onready var level_path: Path2D = $LevelPath
onready var player_position: PathFollow2D = $"%PlayerPosition"
@ -30,6 +31,7 @@ onready var boss_block: TextureRect = $"%BossBlock"
onready var shards_block: HBoxContainer = $"%ShardsBlock"
onready var shards_needed: Label = $"%ShardsNeeded"
onready var world_title: Label = $"%WorldTitle"
onready var options_screen = $OptionsScreen
func _ready() -> void:
var palette = load("res://graphics/player/palettes/%s.tex" % Game.current_palette)
@ -89,12 +91,12 @@ func _process(delta: float) -> void:
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel") and $"%MenuPopup".rect_scale.y >= 1.0:
animation_player.play("hide_menu")
# if event.is_action_pressed("ui_cancel") and $"%MenuPopup".rect_scale.y >= 1.0:
# animation_player.play("hide_menu")
pass
func _gui_input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
if event.is_action_pressed("ui_cancel") or event.is_action_pressed("pause") && $"%MenuPopup".visible == false:
animation_player.play("show_menu")
if not made_selection: # player is walking around
if event.is_action_pressed("ui_accept"):
@ -109,7 +111,8 @@ func _gui_input(event: InputEvent) -> void:
if _can_travel(level):
_select_level(level)
else: # player has selected level
if event.is_action_pressed("ui_accept"):
if event.is_action_pressed("ui_start") or event.is_action_pressed("ui_accept"):
starting_level = true
Game.current_level = selected_level
Game.change_map(LevelData.levels[selected_level].scene)
elif event.is_action_pressed("ui_cancel"):
@ -199,6 +202,16 @@ func _update_stats() -> void:
var save_data: Save.LevelSaveData = Save.current_file.levels[save_id]
if LevelData.levels[selected_level].boss:
boss_time.text = Game.format_time(save_data.time_any)
match selected_level:
3:
$"%PressStartBoss".text = "Press Start To Fight!"
$"%BossFlavorText".text = "Swiftest Slay"
7:
$"%PressStartBoss".text = "Press Start To Fight!"
$"%BossFlavorText".text = "Speediest Smashing"
11:
$"%PressStartBoss".text = "Press Start To Change The Future!"
$"%BossFlavorText".text = "Fastest Future"
animation_player.play("show_boss")
boss_shown = true
else:
@ -227,3 +240,5 @@ func _on_ExitMenu_pressed() -> void:
func _on_PalettesButton_button_down() -> void:
SceneManager.current_scene = load("res://menus/palette_select.tscn").instance()