diff --git a/entities/game/card_template/scripts/CardTemplate.gd b/entities/game/card_template/scripts/CardTemplate.gd index d542564..572d00e 100644 --- a/entities/game/card_template/scripts/CardTemplate.gd +++ b/entities/game/card_template/scripts/CardTemplate.gd @@ -47,7 +47,7 @@ var grid_position: Point var _timer_for_hide_delay: Timer var _was_clicked: bool var _card_frozen: bool = false -var getting_removed: bool = false +var _getting_removed: bool = false var _playing_animation: bool = false var _valid_game_state: bool = false @@ -157,6 +157,7 @@ func is_turned() -> bool: return _was_clicked func remove_from_board(was_ai: bool) -> void: + _getting_removed = true var settings: SettingsResource = SettingsRepository.load_settings() if not settings.animate_card_matches or was_ai: _trigger_remove() @@ -180,8 +181,6 @@ func remove_from_board(was_ai: bool) -> void: ## Wait for some time to display card remove_tween.tween_property(self, "scale", target_scale, settings.animation_time) remove_tween.finished.connect(_trigger_remove) - - getting_removed = true func _trigger_remove() -> void: for group: String in get_groups(): @@ -193,7 +192,7 @@ func is_playing_animation() -> bool: return _playing_animation func is_getting_removed() -> bool: - return getting_removed + return _getting_removed func destory_now() -> void: queue_free() diff --git a/entities/game/memory_game/scripts/GameCardGrid.gd b/entities/game/memory_game/scripts/GameCardGrid.gd index 5abe5b7..88e293e 100644 --- a/entities/game/memory_game/scripts/GameCardGrid.gd +++ b/entities/game/memory_game/scripts/GameCardGrid.gd @@ -251,7 +251,7 @@ func _validate_grid() -> void: card_positions.append(card.grid_position) identical_cards.emit(card_positions[0], card_positions[1]) remove_cards_from_board(card_positions) - var count: int = _get_game_card_templates().filter(func (card: CardTemplate) -> bool: return not card.getting_removed).size() + var count: int = _get_game_card_templates().filter(func (card: CardTemplate) -> bool: return not card.is_getting_removed()).size() if count == 0: _announce_empty_board() @@ -291,7 +291,7 @@ func _any_matching() -> bool: func get_all_card_positions(get_turned: bool = false) -> Array[Point]: var return_data: Array[Point] = [] for card: CardTemplate in _get_game_card_templates_children(): - if card.getting_removed: + if card.is_getting_removed(): continue if get_turned or !card.is_turned(): return_data.append(card.grid_position) diff --git a/entities/game/memory_game/scripts/systems/AiAgentSystem.gd b/entities/game/memory_game/scripts/systems/AiAgentSystem.gd index 359d525..472006d 100644 --- a/entities/game/memory_game/scripts/systems/AiAgentSystem.gd +++ b/entities/game/memory_game/scripts/systems/AiAgentSystem.gd @@ -21,20 +21,12 @@ var last_card: MemoryCardResource = null func card_was_triggered(card: CardTemplate) -> void: add_card_to_all_ais(card.grid_position, card.memory_card) - #for card: CardTemplate in clicked_cards: - - #if !should_play_round: - #return - #if game_state == GameEnum.State.TURN_START and triggered_cards < 2: - #prepare_and_start_timer() func card_was_identically(first_card_position: Point, second_card_position: Point) -> void: remove_card_to_all_ais(first_card_position) remove_card_to_all_ais(second_card_position) - triggered_cards = 0 - #if should_play_round: - #prepare_and_start_timer() + triggered_cards = 0 func game_state_changed(game_state: GameEnum.State) -> void: if should_play_round and game_state == GameEnum.State.TURN_START: @@ -43,7 +35,6 @@ func game_state_changed(game_state: GameEnum.State) -> void: if game_state == GameEnum.State.PREPARE_TURN_END or game_state == GameEnum.State.TURN_FREEZE: timer.stop() - #should_play_round = false return