ability to leave level select for main menu

This commit is contained in:
Haze Weathers 2024-02-27 19:22:25 -05:00
parent 470857ecfa
commit ddafe49d12
2 changed files with 183 additions and 6 deletions

View file

@ -1,4 +1,4 @@
extends Node
extends Control
export var travel_time: float = 1.0
@ -38,6 +38,7 @@ func _ready() -> void:
if target_level != null:
player_position.offset = target_level.offset
_select_level(selected_level)
call_deferred("grab_focus")
#func _input(event: InputEvent) -> void:
# # load selected map
@ -82,7 +83,9 @@ func _process(delta: float) -> void:
else:
player_sprite.visible = true
func _input(event: InputEvent) -> void:
func _gui_input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
animation_player.play("show_exit")
if not made_selection: # player is walking around
if event.is_action_pressed("ui_accept"):
_update_stats()
@ -184,3 +187,13 @@ func _update_stats() -> void:
selected_shard = 0
shard_title.text = LevelData.levels[selected_level].shard_titles[selected_shard]
shard_arrow.position.x = filled_shards.get_child(selected_shard).position.x
func _on_StayHere_pressed() -> void:
animation_player.play("hide_exit")
func _on_ExitMenu_pressed() -> void:
Fade.fade_out(Options.transition_speed_secs)
yield(Fade, "fade_finished")
SceneManager.current_scene = load("res://menus/main_menu.tscn").instance()