Skip to content

Commit 0d081ac

Browse files
committed
added custom squares for board
1 parent 217cbd6 commit 0d081ac

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

game_boards/all_common/common.gd

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ const GEM_POINTS:int = 25
66

77
# =========================================================
88

9-
func fill_grid(hbox:HBoxContainer, grid:GridContainer):
9+
func fill_grid(hbox:HBoxContainer, grid:GridContainer, square0:String, square1:String):
1010
var size = hbox.get_child_count()
1111
for i in range(size):
1212
for j in range(size):
1313
# Load the appropriate scene based on the checkerboard pattern
14-
var brdsq_scene_path = "res://game_boards/board_space/game_board/board_square_1.tscn" # Assume light square
14+
var brdsq_scene_path = square0 # Light square
1515
if (i + j) % 2 == 0:
16-
brdsq_scene_path = "res://game_boards/board_space/game_board/board_square_0.tscn" # Dark square
16+
brdsq_scene_path = square1 # Dark square
1717

1818
# Load and instantiate the scene
1919
var brdsq_scene = load(brdsq_scene_path)

game_boards/board_food/game_board/Board.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func _ready():
2626
# godot setup
2727
randomize()
2828
# A: populate board
29-
CmnFunc.fill_grid(hbox_container, grid_container)
29+
CmnFunc.fill_grid(hbox_container, grid_container, "res://game_boards/board_food/game_board/board_square_0.tscn", "res://game_boards/board_food/game_board/board_square_1.tscn")
3030
CmnFunc.fill_hbox(hbox_container, Enums.GemDict.FOOD, self._on_cell_click)
3131
# B: check board after init
3232
process_game_round()
@@ -36,6 +36,8 @@ func new_game():
3636
# A:
3737
board_props_moves = 0
3838
board_props_score = 0
39+
emit_signal("props_updated_score", board_props_score)
40+
emit_signal("props_updated_moves", board_props_moves)
3941
# B:
4042
CmnFunc.new_game_explode_replace(hbox_container, GEM_COLOR_NAMES, Enums.EXPLODE_DELAY)
4143
# C:

game_boards/board_space/game_board/GemBoard.gd

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func _ready():
2626
# godot setup
2727
randomize()
2828
# A: populate board
29-
CmnFunc.fill_grid(hbox_container, grid_container)
29+
CmnFunc.fill_grid(hbox_container, grid_container, "res://game_boards/board_space/game_board/board_square_0.tscn", "res://game_boards/board_space/game_board/board_square_1.tscn")
3030
CmnFunc.fill_hbox(hbox_container, Enums.GemDict.GEMS, self._on_cell_click)
3131
# B: check board after init
3232
process_game_round()
@@ -36,6 +36,8 @@ func new_game():
3636
# A:
3737
board_props_moves = 0
3838
board_props_score = 0
39+
emit_signal("props_updated_score", board_props_score)
40+
emit_signal("props_updated_moves", board_props_moves)
3941
# B:
4042
CmnFunc.new_game_explode_replace(hbox_container, GEM_COLOR_NAMES, Enums.EXPLODE_DELAY)
4143
# C:

0 commit comments

Comments
 (0)