add basic match3 logic

use proper logging everywhere
add gamepad and keyboard control on match3 gameplay
This commit is contained in:
2025-09-24 16:58:08 +04:00
parent e76297b3f3
commit bbf512b675
14 changed files with 466 additions and 63 deletions

View File

@@ -24,19 +24,28 @@ func set_gameplay_mode(mode: String) -> void:
load_gameplay(mode)
func load_gameplay(mode: String) -> void:
DebugManager.log_debug("Loading gameplay mode: %s" % mode, "Game")
# Clear existing gameplay
for child in gameplay_container.get_children():
DebugManager.log_debug("Removing existing child: %s" % child.name, "Game")
child.queue_free()
# Load new gameplay
if GAMEPLAY_SCENES.has(mode):
DebugManager.log_debug("Found scene path: %s" % GAMEPLAY_SCENES[mode], "Game")
var gameplay_scene = load(GAMEPLAY_SCENES[mode])
var gameplay_instance = gameplay_scene.instantiate()
DebugManager.log_debug("Instantiated gameplay: %s" % gameplay_instance.name, "Game")
gameplay_container.add_child(gameplay_instance)
DebugManager.log_debug("Added gameplay to container, child count now: %d" % gameplay_container.get_child_count(), "Game")
# Connect gameplay signals to shared systems
if gameplay_instance.has_signal("score_changed"):
gameplay_instance.score_changed.connect(_on_score_changed)
DebugManager.log_debug("Connected score_changed signal", "Game")
else:
DebugManager.log_error("Gameplay mode '%s' not found in GAMEPLAY_SCENES" % mode, "Game")
func set_global_score(value: int) -> void:
global_score = value
@@ -47,7 +56,7 @@ func _on_score_changed(points: int) -> void:
self.global_score += points
func _on_back_button_pressed() -> void:
print("Back button pressed in game scene")
DebugManager.log_debug("Back button pressed in game scene", "Game")
AudioManager.play_ui_click()
GameManager.save_game()
GameManager.exit_to_main_menu()
@@ -57,7 +66,7 @@ func _input(event: InputEvent) -> void:
# Debug: Switch to clickomania when Space+Enter pressed together
if current_gameplay_mode == "match3":
set_gameplay_mode("clickomania")
print("Switched to clickomania gameplay")
DebugManager.log_debug("Switched to clickomania gameplay", "Game")
else:
set_gameplay_mode("match3")
print("Switched to match3 gameplay")
DebugManager.log_debug("Switched to match3 gameplay", "Game")