Skip to content

Commit 66d2ff1

Browse files
committed
game props updating correctly
1 parent 3ff00cf commit 66d2ff1

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

game.tscn

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,20 @@ text = "0"
151151
horizontal_alignment = 2
152152
vertical_alignment = 1
153153

154-
[node name="HBoxContainer6" type="HBoxContainer" parent="GameStats"]
154+
[node name="HBoxContainer5" type="HBoxContainer" parent="GameStats"]
155155
layout_mode = 2
156156
theme_override_constants/separation = 25
157157

158-
[node name="Control" type="Control" parent="GameStats/HBoxContainer6"]
158+
[node name="Control" type="Control" parent="GameStats/HBoxContainer5"]
159159
custom_minimum_size = Vector2(128, 128)
160160
layout_mode = 2
161161

162-
[node name="Sprite2D" type="Sprite2D" parent="GameStats/HBoxContainer6/Control"]
162+
[node name="Sprite2D" type="Sprite2D" parent="GameStats/HBoxContainer5/Control"]
163163
scale = Vector2(0.5, 0.5)
164164
texture = ExtResource("6_ot4tf")
165165
centered = false
166166

167-
[node name="Label" type="Label" parent="GameStats/HBoxContainer6"]
167+
[node name="Label" type="Label" parent="GameStats/HBoxContainer5"]
168168
layout_mode = 2
169169
size_flags_horizontal = 3
170170
theme = ExtResource("4_xf0vf")
@@ -174,20 +174,20 @@ text = "0"
174174
horizontal_alignment = 2
175175
vertical_alignment = 1
176176

177-
[node name="HBoxContainer5" type="HBoxContainer" parent="GameStats"]
177+
[node name="HBoxContainer6" type="HBoxContainer" parent="GameStats"]
178178
layout_mode = 2
179179
theme_override_constants/separation = 25
180180

181-
[node name="Control" type="Control" parent="GameStats/HBoxContainer5"]
181+
[node name="Control" type="Control" parent="GameStats/HBoxContainer6"]
182182
custom_minimum_size = Vector2(128, 128)
183183
layout_mode = 2
184184

185-
[node name="Sprite2D" type="Sprite2D" parent="GameStats/HBoxContainer5/Control"]
185+
[node name="Sprite2D" type="Sprite2D" parent="GameStats/HBoxContainer6/Control"]
186186
scale = Vector2(0.5, 0.5)
187187
texture = ExtResource("7_o4d3d")
188188
centered = false
189189

190-
[node name="Label" type="Label" parent="GameStats/HBoxContainer5"]
190+
[node name="Label" type="Label" parent="GameStats/HBoxContainer6"]
191191
layout_mode = 2
192192
size_flags_horizontal = 3
193193
theme = ExtResource("4_xf0vf")

game_board/GameBoard.gd

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,9 @@ func swap_gem_cells(swap_cell_1:GemCell, swap_cell_2:GemCell):
243243
# E: re-position and tween
244244
call_deferred("setup_tween", swap_cell_2, orig_pos_cell_1, orig_pos_cell_2)
245245
call_deferred("setup_tween", swap_cell_1, orig_pos_cell_2, orig_pos_cell_1)
246+
247+
# F:
248+
signal_game_props_count_gems()
246249

247250
func setup_tween(gem_cell:GemCell, start_pos:Vector2, end_pos:Vector2):
248251
gem_cell.sprite.global_position = start_pos # NOTE: Set initial position right before tweening
@@ -281,14 +284,16 @@ func check_board_explode_matches():
281284
board_props_score += 10
282285
emit_signal("props_updated_score", board_props_score)
283286

287+
# A:
288+
signal_game_props_count_gems()
289+
290+
# B:
284291
var gem_matches = get_first_match_gems()
285292
if gem_matches.size() > 0:
286293
debug_print_ascii_table(gem_matches)
287294
if gem_matches.size() == 0:
288295
Enums.debug_print("[check_board_explode_matches]: No more matches. Board stable.", Enums.DEBUG_LEVEL.INFO)
289296
# A:
290-
signal_game_props_count_gems()
291-
292297
# B: TODO: check for "NO MORE MOVES"
293298
# C: Reset undo cells or perform other cleanup here.
294299
if undo_cell_1 and undo_cell_2:
@@ -472,3 +477,4 @@ func debug_make_gem_grid():
472477
gem.initialize(Enums.GemColor.GREEN)
473478
if (i + j) % 2 == 0:
474479
gem.initialize(Enums.GemColor.WHITE)
480+
signal_game_props_count_gems()

0 commit comments

Comments
 (0)