From 3d821bf1385947081e68d46d33d9ee2fad9d6a8f Mon Sep 17 00:00:00 2001 From: Xanatos <10531466+XanatosX@users.noreply.github.com> Date: Tue, 30 Jun 2026 21:36:22 +0200 Subject: [PATCH 1/2] fix: mobile game not starting --- entities/game/memory_game/scenes/MemoryGame.tscn | 9 ++++++--- .../memory_game/scripts/CardInteractionField.gd | 11 +++++++++-- .../game/memory_game/scripts/GameCardGrid.gd | 6 +++--- entities/game/memory_game/scripts/MemoryGame.gd | 15 +++++++++++---- .../scripts/systems/GameStateSystem.gd | 16 +++++++++++++++- .../scripts/systems/TutorialStateSystem.gd | 2 +- .../players_overlay/scripts/PlayerGameOverlay.gd | 2 +- .../entities/game_state/scripts/GameStateEnum.gd | 3 ++- .../game_manager/scripts/GameManager.gd | 9 +++++++-- 9 files changed, 55 insertions(+), 18 deletions(-) diff --git a/entities/game/memory_game/scenes/MemoryGame.tscn b/entities/game/memory_game/scenes/MemoryGame.tscn index aafd594..5c0a980 100644 --- a/entities/game/memory_game/scenes/MemoryGame.tscn +++ b/entities/game/memory_game/scenes/MemoryGame.tscn @@ -240,6 +240,10 @@ debug_functions = Array[ExtResource("34_4hsit")]([SubResource("Resource_8rpam")] [connection signal="load_game" from="." to="World/CardBoard/CardInteractionField" method="set_board_information"] [connection signal="request_popup" from="." to="Systems/PopupSystem" method="add_and_show_popup"] [connection signal="force_close_popup" from="Systems/GameStateSystem" to="Systems/PopupSystem" method="force_close_popup_with_id"] +[connection signal="game_has_ended" from="Systems/GameStateSystem" to="World/CardBoard/CardVisuals" method="hide"] +[connection signal="game_has_ended" from="Systems/GameStateSystem" to="UI/PauseMenuButton" method="hide"] +[connection signal="game_has_ended" from="Systems/GameStateSystem" to="UI/PlayersOverlay" method="hide"] +[connection signal="game_has_ended" from="Systems/GameStateSystem" to="UI/ZoomButtons" method="hide"] [connection signal="request_popup" from="Systems/GameStateSystem" to="Systems/PopupSystem" method="add_and_show_popup"] [connection signal="state_changed" from="Systems/GameStateSystem" to="." method="game_state_has_changed"] [connection signal="state_changed" from="Systems/GameStateSystem" to="Systems/TutorialStateSystem" method="state_changed"] @@ -281,21 +285,20 @@ debug_functions = Array[ExtResource("34_4hsit")]([SubResource("Resource_8rpam")] [connection signal="all_matching_cards_removed" from="World/CardBoard" to="Systems/GameStateSystem" method="matches_found"] [connection signal="all_matching_cards_removed" from="World/CardBoard" to="Systems/TutorialStateSystem" method="matching_card_found"] [connection signal="all_matching_cards_removed" from="World/CardBoard" to="Systems/PlayerSystem" method="player_scored"] -[connection signal="board_empty" from="World/CardBoard" to="." method="show_game_end_screen"] -[connection signal="board_empty" from="World/CardBoard" to="Systems/GameStateSystem" method="board_empty"] [connection signal="board_ready" from="World/CardBoard" to="Systems/GameStateSystem" method="board_ready"] [connection signal="card_activated" from="World/CardBoard" to="Systems/GameStateSystem" method="card_was_clicked"] [connection signal="card_activated" from="World/CardBoard" to="Systems/TutorialStateSystem" method="card_triggered"] +[connection signal="card_removed" from="World/CardBoard" to="World/CardBoard/CardInteractionField" method="remove_card"] [connection signal="card_triggered" from="World/CardBoard" to="Systems/AiAgentSystem" method="card_was_triggered"] [connection signal="identical_cards" from="World/CardBoard" to="Systems/AiAgentSystem" method="card_was_identically"] [connection signal="no_matches_found" from="World/CardBoard" to="Systems/GameStateSystem" method="no_matches"] [connection signal="board_area" from="World/CardBoard/CardInteractionField" to="World/Camera2D" method="adjust_zoom_and_position_to_play_area"] -[connection signal="board_build" from="World/CardBoard/CardInteractionField" to="." method="all_cards_placed"] [connection signal="board_build" from="World/CardBoard/CardInteractionField" to="Systems/GameStateSystem" method="game_field_ready"] [connection signal="board_build" from="World/CardBoard/CardInteractionField" to="UI/PauseMenuButton" method="show_button_if_valid"] [connection signal="board_build" from="World/CardBoard/CardInteractionField" to="UI/PlayersOverlay" method="show"] [connection signal="board_build" from="World/CardBoard/CardInteractionField" to="UI/ZoomButtons/ZoomIn" method="show_button_if_valid"] [connection signal="board_build" from="World/CardBoard/CardInteractionField" to="UI/ZoomButtons/ZoomOut" method="show_button_if_valid"] +[connection signal="board_empty" from="World/CardBoard/CardInteractionField" to="Systems/GameStateSystem" method="board_empty"] [connection signal="clicked" from="World/CardBoard/CardInteractionField" to="World/CardBoard" method="trigger_card_at_position"] [connection signal="mouse_enter" from="World/CardBoard/CardInteractionField" to="World/CardBoard" method="select_card_at_position"] [connection signal="place_card" from="World/CardBoard/CardInteractionField" to="World/CardBoard" method="place_card"] diff --git a/entities/game/memory_game/scripts/CardInteractionField.gd b/entities/game/memory_game/scripts/CardInteractionField.gd index 906851c..40ce260 100644 --- a/entities/game/memory_game/scripts/CardInteractionField.gd +++ b/entities/game/memory_game/scripts/CardInteractionField.gd @@ -8,6 +8,9 @@ signal place_card(card: MemoryCardResource, grid_position: Vector2i, world_posit signal board_area(area: Rect2) signal board_build() +## The whole board is empty now +signal board_empty() + enum Axis {X, Y} @export var default_texture_size: Vector2 = Vector2(499, 550) @@ -126,6 +129,12 @@ func remove_card(grid_position: Vector2i) -> void: var child: CardCollider = _placed_cards.get(grid_position) child.queue_free() _placed_cards.erase(grid_position) + _check_if_board_empty() + +func _check_if_board_empty() -> void: + if _placed_cards.size() == 0: + board_empty.emit() + func player_changed(current_player: PlayerResource) -> void: _is_ai_player = current_player.is_ai() @@ -149,8 +158,6 @@ func _change_interaction_state(new_state: bool) -> void: else: child.disable_collider() - - func parse_movement(information: Vector2) -> void: if get_tree().paused or _is_ai_player: _controller_input_was_made = false diff --git a/entities/game/memory_game/scripts/GameCardGrid.gd b/entities/game/memory_game/scripts/GameCardGrid.gd index 5d23c11..df718dd 100644 --- a/entities/game/memory_game/scripts/GameCardGrid.gd +++ b/entities/game/memory_game/scripts/GameCardGrid.gd @@ -1,6 +1,6 @@ class_name GameCardGrid extends Node2D -signal card_removed() +signal card_removed(grid_position: Vector2i) signal all_matching_cards_removed() signal card_triggered(CardTemplate: CardTemplate) signal identical_cards(first_card_Vector2i: Vector2i, set_icon_modulated_card_Vector2i: Vector2i) @@ -42,7 +42,7 @@ func remove_cards_from_board(grid_positions: Array[Vector2i]) -> void: remove_card_from_board(grid_position) for card: CardTemplate in _get_game_card_templates(): if card.is_playing_animation(): - await card.about_to_get_delete + await card.about_to_get_delete all_matching_cards_removed.emit() GlobalSoundManager.play_sound_effect(matching_card_sound_effect) @@ -50,7 +50,7 @@ func remove_card_from_board(grid_position: Vector2i) -> void: for child: CardTemplate in _get_game_card_templates_children(): if child.grid_position == grid_position: child.remove_from_board(currently_ai_player) - child.about_to_get_delete.connect(func() -> void: card_removed.emit()) + card_removed.emit(child.grid_position) func select_card_at_position(grid_position: Vector2i) -> bool: var found_card: bool = false diff --git a/entities/game/memory_game/scripts/MemoryGame.gd b/entities/game/memory_game/scripts/MemoryGame.gd index 95df825..e300b45 100644 --- a/entities/game/memory_game/scripts/MemoryGame.gd +++ b/entities/game/memory_game/scripts/MemoryGame.gd @@ -7,6 +7,8 @@ signal game_paused(is_paused: bool) signal request_popup(window: PopupWindow) +signal game_loaded() + const CARDS_PER_PLAYER: int = 2 @export_group("Game Setup") @@ -17,6 +19,7 @@ const CARDS_PER_PLAYER: int = 2 var _card_deck: Resource +var _initial_start: bool = true #var current_game_state: int var player_node: PlayerSystem @@ -101,7 +104,10 @@ func execute_logic() -> bool: func game_state_has_changed(new_state: GameEnum.State) -> void: if new_state == GameEnum.State.TURN_START: + _handle_initial_start() turn_start_trigger() + if new_state == GameEnum.State.ANIMATION_CLEARED: + show_game_end_screen() ## This will be triggered if a new turn does start func turn_start_trigger() -> void: @@ -112,11 +118,12 @@ func turn_start_trigger() -> void: print("Start Round") triggered_cards = 0 -func all_cards_placed() -> void: - for child: Node in get_tree().get_nodes_in_group("game_initialize_scene"): - child.queue_free() - GlobalSoundManager.stop_all_sounds() +func _handle_initial_start() -> void: + if not _initial_start: + return + _initial_start = false process_mode = Node.PROCESS_MODE_INHERIT + game_loaded.emit() func get_systems() -> Systems: return _systems \ No newline at end of file diff --git a/entities/game/memory_game/scripts/systems/GameStateSystem.gd b/entities/game/memory_game/scripts/systems/GameStateSystem.gd index 854f25d..29c7aec 100644 --- a/entities/game/memory_game/scripts/systems/GameStateSystem.gd +++ b/entities/game/memory_game/scripts/systems/GameStateSystem.gd @@ -3,6 +3,7 @@ class_name GameStateSystem extends Node signal state_changed(new_state: GameEnum.State) signal request_popup(window: PopupWindow) signal force_close_popup(id: int) +signal game_has_ended() @export var round_end_message: TextTranslation @export var round_end_message_no_auto_complete: TextTranslation @@ -41,6 +42,8 @@ func card_was_clicked() -> void: func matches_found() -> void: print("match found") + if _current_state == GameEnum.State.GAME_END: + animation_cleared() _change_state(GameEnum.State.TURN_START) func no_matches() -> void: @@ -52,12 +55,23 @@ func board_ready() -> void: print("board ready") _change_state(GameEnum.State.TURN_START) - func board_empty() -> void: print("board empty") _change_state(GameEnum.State.PREPARE_TURN_END) _change_state(GameEnum.State.GAME_END) + var emergency_timer: Timer = Timer.new() + emergency_timer.one_shot = true + emergency_timer.timeout.connect(animation_cleared) + add_child(emergency_timer) + emergency_timer.start(2) + +func animation_cleared() -> void: + if _current_state != GameEnum.State.GAME_END: + return + _change_state(GameEnum.State.ANIMATION_CLEARED) + game_has_ended.emit() + func _show_round_ended_banner() -> void: var settings: SettingsResource = SettingsRepository.load_settings() as SettingsResource var auto_close: bool = settings.auto_close_round diff --git a/entities/game/memory_game/scripts/systems/TutorialStateSystem.gd b/entities/game/memory_game/scripts/systems/TutorialStateSystem.gd index 8362d04..825cb58 100644 --- a/entities/game/memory_game/scripts/systems/TutorialStateSystem.gd +++ b/entities/game/memory_game/scripts/systems/TutorialStateSystem.gd @@ -88,4 +88,4 @@ func abort_tutorial() -> void: _save_settings() func _save_settings() -> void: - SettingsRepository.save_settings(_settings) \ No newline at end of file + SettingsRepository.save_settings(_settings) diff --git a/entities/game/players_overlay/scripts/PlayerGameOverlay.gd b/entities/game/players_overlay/scripts/PlayerGameOverlay.gd index 7963596..535edbe 100644 --- a/entities/game/players_overlay/scripts/PlayerGameOverlay.gd +++ b/entities/game/players_overlay/scripts/PlayerGameOverlay.gd @@ -48,7 +48,7 @@ func game_ended() -> void: func game_state_changed(game_state: GameEnum.State) -> void: if game_state == GameEnum.State.TURN_END: round_end() - if game_state == GameEnum.State.GAME_END: + if game_state == GameEnum.State.ANIMATION_CLEARED: visible = false func get_global_position_of_current_player() -> Vector2: diff --git a/shared/entities/game_state/scripts/GameStateEnum.gd b/shared/entities/game_state/scripts/GameStateEnum.gd index ce525ec..0c719ec 100644 --- a/shared/entities/game_state/scripts/GameStateEnum.gd +++ b/shared/entities/game_state/scripts/GameStateEnum.gd @@ -7,5 +7,6 @@ enum State { TURN_COMPLETED = 30, # Can only go to prepare turn end or turn start PREPARE_TURN_END = 40, # Can go to turn end or end game TURN_END = 50, # Can go to turn start - GAME_END = 1000 + GAME_END = 1000, + ANIMATION_CLEARED = 10000 } \ No newline at end of file diff --git a/shared/global_entities/game_manager/scripts/GameManager.gd b/shared/global_entities/game_manager/scripts/GameManager.gd index 0606cc7..2fc485d 100644 --- a/shared/global_entities/game_manager/scripts/GameManager.gd +++ b/shared/global_entities/game_manager/scripts/GameManager.gd @@ -258,17 +258,22 @@ func load_game(card_deck: MemoryDeckResource, players: Array[PlayerResource], cl loading_screen.add_to_group("game_initialize_scene") loading_screen.set_follow_up_node(game_scene_node) + game_scene_node.game_loaded.connect(_destroy_game_loading_screen.bind(loading_screen, active_nodes)) + await ScreenTransitionManager.transit_screen_by_node_with_position(loading_screen, click_position, false) if old_camera != null and not old_camera.is_queued_for_deletion(): old_camera.zoom = Vector2.ONE old_camera.queue_free() add_child(game_scene_node) - for node: Node in active_nodes: + +func _destroy_game_loading_screen(screen: LoadingScreen, old_nodes: Array[Node]) -> void: + screen.queue_free() + GlobalSoundManager.stop_all_sounds() + for node: Node in old_nodes: if node == null or node.is_queued_for_deletion(): continue node.queue_free() - func get_available_decks() -> Array[MemoryDeckResource]: var return_array: Array[MemoryDeckResource] = [] return_array.append_array(translated_build_in_decks) From 8cc261d7a9af4c6944ec8b5d26a1e532d1b644d9 Mon Sep 17 00:00:00 2001 From: Xanatos <10531466+XanatosX@users.noreply.github.com> Date: Tue, 30 Jun 2026 21:37:40 +0200 Subject: [PATCH 2/2] chore: increase game version to 0.20.2 --- project.godot | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project.godot b/project.godot index 4f8d516..5ec7584 100644 --- a/project.godot +++ b/project.godot @@ -15,7 +15,7 @@ compatibility/default_parent_skeleton_in_mesh_instance_3d=true [application] config/name="Samory" -config/version="0.20.1" +config/version="0.20.2" config/tags=PackedStringArray("public") run/main_scene="res://shared/global_entities/game_manager/scenes/GameManager.tscn" config/features=PackedStringArray("4.7", "GL Compatibility")