match-3 grid generation

make game scene modular
global debug mode
This commit is contained in:
2025-09-24 10:45:14 +04:00
committed by nett00n
parent e11e864b26
commit 7182c45351
21 changed files with 506 additions and 94 deletions

View File

@@ -2,29 +2,39 @@ extends Node
const GAME_SCENE_PATH := "res://scenes/game/game.tscn"
const MAIN_SCENE_PATH := "res://scenes/main/main.tscn"
const MATCH3_SCENE_PATH := "res://scenes/match3/match3.tscn"
var pending_gameplay_mode: String = "match3"
func start_new_game() -> void:
start_game_with_mode("match3")
func start_match3_game() -> void:
start_game_with_mode("match3")
func start_clickomania_game() -> void:
start_game_with_mode("clickomania")
func start_game_with_mode(gameplay_mode: String) -> void:
pending_gameplay_mode = gameplay_mode
var packed_scene := load(GAME_SCENE_PATH)
if not packed_scene or not packed_scene is PackedScene:
push_error("Failed to load Game scene at: %s" % GAME_SCENE_PATH)
return
get_tree().change_scene_to_packed(packed_scene)
# Wait one frame for the scene to be ready, then set gameplay mode
await get_tree().process_frame
if get_tree().current_scene and get_tree().current_scene.has_method("set_gameplay_mode"):
get_tree().current_scene.set_gameplay_mode(pending_gameplay_mode)
func save_game() -> void:
print("Game saved (mock)")
func exit_to_main_menu() -> void:
print("GameManager: Attempting to exit to main menu")
var packed_scene := load(MAIN_SCENE_PATH)
if not packed_scene or not packed_scene is PackedScene:
push_error("Failed to load Main scene at: %s" % MAIN_SCENE_PATH)
return
get_tree().change_scene_to_packed(packed_scene)
func start_match3_game() -> void:
var packed_scene := load(MATCH3_SCENE_PATH)
if not packed_scene or not packed_scene is PackedScene:
push_error("Failed to load Match3 scene at: %s" % MATCH3_SCENE_PATH)
return
print("GameManager: Loading main scene")
get_tree().change_scene_to_packed(packed_scene)