Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 3 additions & 4 deletions entities/game/card_template/scripts/CardTemplate.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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():
Expand All @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions entities/game/memory_game/scripts/GameCardGrid.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down Expand Up @@ -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)
Expand Down
11 changes: 1 addition & 10 deletions entities/game/memory_game/scripts/systems/AiAgentSystem.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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


Expand Down
Loading