make grid shuffle, grid sizy, gem color types

This commit is contained in:
2025-09-24 01:39:18 +04:00
parent de68edb1b0
commit 122b5cb55f
12 changed files with 565 additions and 48 deletions

View File

@@ -1,27 +1,17 @@
extends Node
@onready var back_button: Button = $BackButtonContainer/BackButton
const MATCH3_SCENE_PATH := "res://scenes/match3/match3.tscn"
var match3_instance: Node
# Fixed: Use static Match3 instance from scene instead of dynamic loading
@onready var match3_instance: Node = $Match3
func _ready() -> void:
if not back_button.pressed.is_connected(_on_back_button_pressed):
back_button.pressed.connect(_on_back_button_pressed)
_load_match3_scene()
# Fixed: No need to load match3 scene - it's already in the scene tree
func _on_back_button_pressed() -> void:
AudioManager.play_ui_click()
GameManager.save_game()
if match3_instance and is_instance_valid(match3_instance):
match3_instance.queue_free()
# Fixed: Don't free the static instance, just exit
GameManager.exit_to_main_menu()
func _load_match3_scene() -> void:
var match3_scene := load(MATCH3_SCENE_PATH)
if not match3_scene or not match3_scene is PackedScene:
push_error("Failed to load Match3 scene at: %s" % MATCH3_SCENE_PATH)
return
match3_instance = match3_scene.instantiate()
add_child(match3_instance)

View File

@@ -1,7 +1,9 @@
[gd_scene load_steps=3 format=3 uid="uid://dmwkyeq2l7u04"]
[gd_scene load_steps=5 format=3 uid="uid://dmwkyeq2l7u04"]
[ext_resource type="Script" uid="uid://b16jnk7w22mb" path="res://scenes/game/game.gd" id="1_uwrxv"]
[ext_resource type="PackedScene" uid="uid://b4kv7g7kllwgb" path="res://scenes/match3/match3.tscn" id="2_yqjtg"]
[ext_resource type="PackedScene" path="res://scenes/ui/DebugToggle.tscn" id="3_debug"]
[ext_resource type="PackedScene" uid="uid://fax5m4ywp1r3" path="res://scenes/ui/DebugMenu.tscn" id="4_debug_menu"]
[node name="Game" type="Node"]
script = ExtResource("1_uwrxv")
@@ -19,3 +21,7 @@ offset_bottom = 31.0
text = "back"
[node name="Match3" parent="." instance=ExtResource("2_yqjtg")]
[node name="DebugToggle" parent="." instance=ExtResource("3_debug")]
[node name="DebugMenu" parent="." instance=ExtResource("4_debug_menu")]