Add audio bus configuration for various sound effects and update main scene reference
This commit is contained in:
@@ -142,3 +142,20 @@ func pause_game() -> void:
|
||||
|
||||
func resume_game() -> void:
|
||||
Engine.time_scale = 1
|
||||
|
||||
|
||||
|
||||
func start_new_game() -> void:
|
||||
reset_player_state()
|
||||
player_state["current_level"] = 0
|
||||
player_state["unlocked_levels"] = [0] # Start with the first level unlocked
|
||||
get_tree().change_scene_to_packed(level_scenes[0])
|
||||
|
||||
|
||||
func continue_game() -> void:
|
||||
# todo: load player state from save file
|
||||
|
||||
if player_state["current_level"] < level_scenes.size():
|
||||
get_tree().change_scene_to_packed(level_scenes[player_state["current_level"]])
|
||||
else:
|
||||
printerr("No levels unlocked to continue.")
|
6
scripts/ui/credits.gd
Normal file
6
scripts/ui/credits.gd
Normal file
@@ -0,0 +1,6 @@
|
||||
extends Control
|
||||
|
||||
func _unhandled_input(event: InputEvent) -> void:
|
||||
if event.is_action_pressed("ui_cancel"):
|
||||
if UiManager.is_screen_on_top(self):
|
||||
UiManager.pop_screen()
|
1
scripts/ui/credits.gd.uid
Normal file
1
scripts/ui/credits.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dtjgndehihl6d
|
57
scripts/ui/main_menu.gd
Normal file
57
scripts/ui/main_menu.gd
Normal file
@@ -0,0 +1,57 @@
|
||||
extends Node
|
||||
|
||||
@export var main_menu_control: Control
|
||||
@export var new_game_button: Button
|
||||
@export var continue_button: Button
|
||||
@export var settings_button: Button
|
||||
@export var credits_button: Button
|
||||
@export var exit_button: Button
|
||||
@export var version_label: Label
|
||||
@export var settings_control: Control
|
||||
@export var credits_control: Control
|
||||
|
||||
@onready var gm: GM = $"/root/GameManager"
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
if new_game_button:
|
||||
new_game_button.pressed.connect(_on_new_game_button_pressed)
|
||||
if continue_button:
|
||||
continue_button.pressed.connect(_on_continue_button_pressed)
|
||||
if settings_button:
|
||||
settings_button.pressed.connect(_on_settings_button_pressed)
|
||||
if credits_button:
|
||||
credits_button.pressed.connect(_on_credits_button_pressed)
|
||||
if exit_button:
|
||||
exit_button.pressed.connect(quit_game)
|
||||
if version_label:
|
||||
version_label.text = "v. " + ProjectSettings.get_setting("application/config/version")
|
||||
|
||||
|
||||
func _on_new_game_button_pressed() -> void:
|
||||
if gm:
|
||||
gm.start_new_game()
|
||||
else:
|
||||
printerr("GameManager not found. Cannot start new game.")
|
||||
|
||||
|
||||
func _on_continue_button_pressed() -> void:
|
||||
if gm:
|
||||
gm.continue_game()
|
||||
else:
|
||||
printerr("GameManager not found. Cannot continue game.")
|
||||
|
||||
|
||||
func quit_game() -> void:
|
||||
if gm:
|
||||
gm.quit_game()
|
||||
|
||||
|
||||
func _on_settings_button_pressed() -> void:
|
||||
if settings_control:
|
||||
UiManager.push_screen(settings_control)
|
||||
|
||||
|
||||
func _on_credits_button_pressed() -> void:
|
||||
if credits_control:
|
||||
UiManager.push_screen(credits_control)
|
1
scripts/ui/main_menu.gd.uid
Normal file
1
scripts/ui/main_menu.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://hyfvthdbgjbc
|
Reference in New Issue
Block a user