Skip to content

Commit 444bfdc

Browse files
committed
WIP
1 parent 8d715c8 commit 444bfdc

24 files changed

+2330
-32
lines changed
File renamed without changes.
File renamed without changes.

game/game.tscn renamed to game_boards/board01/game/game.tscn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
[gd_scene load_steps=24 format=3 uid="uid://b5bfm2244ywxk"]
22

3-
[ext_resource type="Script" path="res://game/game.gd" id="1_ewnxx"]
3+
[ext_resource type="Script" path="res://game_boards/board01/game/game.gd" id="1_ewnxx"]
44
[ext_resource type="Texture2D" uid="uid://cnlqirgwr8d4" path="res://assets/bkgd/Background.png" id="1_h8otn"]
5-
[ext_resource type="PackedScene" uid="uid://x4qq2j3l7nvb" path="res://game_board/board.tscn" id="2_2ltbx"]
6-
[ext_resource type="PackedScene" uid="uid://d0yw6oyw3qib0" path="res://game/animated_cloud.tscn" id="3_a1y13"]
5+
[ext_resource type="PackedScene" uid="uid://x4qq2j3l7nvb" path="res://game_boards/board01/game_board/board.tscn" id="2_2ltbx"]
6+
[ext_resource type="PackedScene" uid="uid://d0yw6oyw3qib0" path="res://game_boards/board01/game/animated_cloud.tscn" id="3_a1y13"]
77
[ext_resource type="Texture2D" uid="uid://cwhjcn0y744nv" path="res://assets/gems/background-space.png" id="3_latsb"]
88
[ext_resource type="Texture2D" uid="uid://b8biy2iputyhe" path="res://assets/gems/characters_0002.png" id="3_qywvx"]
99
[ext_resource type="Texture2D" uid="uid://duau66qew6757" path="res://assets/gems/characters_0001.png" id="3_sh4xh"]

game_board/GameBoard.gd renamed to game_boards/board01/game_board/GameBoard.gd

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ signal board_match_multi(match_cnt:int)
1313
#VARS
1414
const GEM_COLOR_NAMES = [Enums.GemColor.WHITE, Enums.GemColor.RED, Enums.GemColor.YELLOW, Enums.GemColor.GREEN, Enums.GemColor.PURPLE, Enums.GemColor.BROWN]
1515
const GEM_POINTS:int = 25
16-
var selected_cell_1:GemCell = null
17-
var selected_cell_2:GemCell = null
18-
var undo_cell_1:GemCell = null
19-
var undo_cell_2:GemCell = null
16+
var selected_cell_1:GemCell1 = null
17+
var selected_cell_2:GemCell1 = null
18+
var undo_cell_1:GemCell1 = null
19+
var undo_cell_2:GemCell1 = null
2020
var tweens_running_cnt:int = 0
2121
var board_props_moves:int = 0
2222
var board_props_score:int = 0
@@ -38,9 +38,9 @@ func fill_grid():
3838
for i in range(size):
3939
for j in range(size):
4040
# Load the appropriate scene based on the checkerboard pattern
41-
var brdsq_scene_path = "res://game_board/board_square_1.tscn" # Assume light square
41+
var brdsq_scene_path = "res://game_boards/board01/game_board/board_square_1.tscn" # Assume light square
4242
if (i + j) % 2 == 0:
43-
brdsq_scene_path = "res://game_board/board_square_0.tscn" # Dark square
43+
brdsq_scene_path = "res://game_boards/board01/game_board/board_square_0.tscn" # Dark square
4444

4545
# Load and instantiate the scene
4646
var brdsq_scene = load(brdsq_scene_path)
@@ -55,8 +55,8 @@ func fill_hbox():
5555
# A: random gem
5656
var gem_type = GEM_COLOR_NAMES[randi() % GEM_COLOR_NAMES.size()]
5757
# B: create/add
58-
var gem_cell_scene = load("res://game_board/gem_cell.tscn")
59-
var gem_cell:GemCell = gem_cell_scene.instantiate()
58+
var gem_cell_scene = load("res://game_boards/board01/game_board/gem_cell.tscn")
59+
var gem_cell:GemCell1 = gem_cell_scene.instantiate()
6060
hbox_container.get_child(col_idx).add_child(gem_cell)
6161
gem_cell.initialize(gem_type)
6262
var control_node = gem_cell.get_node("GemControl")
@@ -68,7 +68,7 @@ func fill_hbox():
6868

6969
# UTILS
7070

71-
func find_gem_indices(gem_cell:GemCell) -> Dictionary:
71+
func find_gem_indices(gem_cell:GemCell1) -> Dictionary:
7272
var parent_vbox = gem_cell.get_parent() # Assuming direct parent is a VBoxContainer
7373
var hbox = parent_vbox.get_parent() # Assuming direct parent of VBox is the HBoxContainer
7474

@@ -81,15 +81,15 @@ func find_gem_indices(gem_cell:GemCell) -> Dictionary:
8181
vbox_index = i
8282
break
8383

84-
# Get the index of the GemCell in the VBoxContainer
84+
# Get the index of the GemCell1 in the VBoxContainer
8585
for j in range(parent_vbox.get_child_count()):
8686
if parent_vbox.get_child(j) == gem_cell:
8787
gem_index = j
8888
break
8989

9090
return {"column": vbox_index, "row": gem_index}
9191

92-
func are_cells_adjacent(gemcell1:GemCell, gemcell2:GemCell) -> bool:
92+
func are_cells_adjacent(gemcell1:GemCell1, gemcell2:GemCell1) -> bool:
9393
var cell1 = find_gem_indices(gemcell1)
9494
var cell2 = find_gem_indices(gemcell2)
9595
var col1 = cell1.column
@@ -119,7 +119,7 @@ func get_all_matches() -> Array:
119119
var streak = 0
120120
var match_start = 0
121121
for column in range(num_columns):
122-
var gem_cell = hbox_container.get_child(column).get_child(row) as GemCell
122+
var gem_cell = hbox_container.get_child(column).get_child(row) as GemCell1
123123
if gem_cell.gem_color == last_color:
124124
streak += 1
125125
else:
@@ -149,7 +149,7 @@ func get_all_matches() -> Array:
149149
var streak = 0
150150
var match_start = 0
151151
for row in range(num_rows):
152-
var gem_cell = hbox_container.get_child(column).get_child(row) as GemCell
152+
var gem_cell = hbox_container.get_child(column).get_child(row) as GemCell1
153153
if gem_cell.gem_color == last_color:
154154
streak += 1
155155
else:
@@ -203,7 +203,7 @@ func calculate_scores_for_each_match(matches: Array) -> Dictionary:
203203
# STEP 1: Handle input (=capture first & second selection), swap gems
204204
# @desc: calls `swap_gem_cells()` when 2 cells selected and are adjacent
205205

206-
func _on_cell_click(gem_cell:GemCell):
206+
func _on_cell_click(gem_cell:GemCell1):
207207
Enums.debug_print("[_on_cell_click] gem_cell.......: "+JSON.stringify(find_gem_indices(gem_cell)), Enums.DEBUG_LEVEL.INFO)
208208
Enums.debug_print("[_on_cell_click] ---------------------------------------------", Enums.DEBUG_LEVEL.INFO)
209209

@@ -213,7 +213,7 @@ func _on_cell_click(gem_cell:GemCell):
213213
if selected_cell_2:
214214
selected_cell_2.play_selected_anim(false)
215215

216-
# STEP 1: Select GemCell logic
216+
# STEP 1: Select GemCell1 logic
217217
if not selected_cell_1:
218218
selected_cell_1 = gem_cell
219219
elif selected_cell_1 != gem_cell:
@@ -245,7 +245,7 @@ func _on_cell_click(gem_cell:GemCell):
245245

246246
# STEP 2: Swap gems: capture current gems, move scenes via tween
247247

248-
func swap_gem_cells(swap_cell_1:GemCell, swap_cell_2:GemCell):
248+
func swap_gem_cells(swap_cell_1:GemCell1, swap_cell_2:GemCell1):
249249
if not swap_cell_1 or not swap_cell_2:
250250
return
251251

@@ -275,7 +275,7 @@ func swap_gem_cells(swap_cell_1:GemCell, swap_cell_2:GemCell):
275275
# F:
276276
signal_game_props_count_gems()
277277

278-
func setup_tween(gem_cell:GemCell, start_pos:Vector2, end_pos:Vector2):
278+
func setup_tween(gem_cell:GemCell1, start_pos:Vector2, end_pos:Vector2):
279279
gem_cell.sprite.global_position = start_pos # NOTE: Set initial position right before tweening
280280
tweens_running_cnt += 1
281281
var tween = get_tree().create_tween()
@@ -449,7 +449,7 @@ func signal_game_props_count_gems():
449449
func debug_print_column_ascii(column: VBoxContainer, column_index: int):
450450
var output = ""
451451
for i in range(column.get_child_count() - 1, -1, -1): # Print from top to bottom
452-
var gem_cell = column.get_child(i) as GemCell
452+
var gem_cell = column.get_child(i) as GemCell1
453453
if gem_cell != null:
454454
output += "[ " + Enums.get_color_name_by_value(gem_cell.gem_color).substr(0,1) + " ]" # Append each gem's color to the output string
455455
else:
@@ -519,13 +519,13 @@ func debug_clear_debug_labels():
519519

520520
func debug_make_match_col():
521521
var col0:VBoxContainer = hbox_container.get_child(0)
522-
var col0_child4:GemCell = col0.get_child(4)
522+
var col0_child4:GemCell1 = col0.get_child(4)
523523
col0_child4.initialize(Enums.GemColor.GREEN)
524-
var col0_child5:GemCell = col0.get_child(5)
524+
var col0_child5:GemCell1 = col0.get_child(5)
525525
col0_child5.initialize(Enums.GemColor.GREEN)
526-
var col0_child6:GemCell = col0.get_child(6)
526+
var col0_child6:GemCell1 = col0.get_child(6)
527527
col0_child6.initialize(Enums.GemColor.GREEN)
528-
var col0_child7:GemCell = col0.get_child(7)
528+
var col0_child7:GemCell1 = col0.get_child(7)
529529
col0_child7.initialize(Enums.GemColor.GREEN)
530530

531531
func debug_make_gem_grid():
File renamed without changes.

game_board/GemCell.gd renamed to game_boards/board01/game_board/GemCell.gd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
extends Control
2-
class_name GemCell
2+
class_name GemCell1
33
# VARS
44
@onready var sprite:Sprite2D = $Sprite2D
55
@onready var anim_player_fx:AnimationPlayer = $AnimPlayerFx
File renamed without changes.

game_board/board.tscn renamed to game_boards/board01/game_board/board.tscn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
[gd_scene load_steps=5 format=3 uid="uid://x4qq2j3l7nvb"]
22

3-
[ext_resource type="Script" path="res://game_board/GameBoard.gd" id="1_8mgoe"]
4-
[ext_resource type="PackedScene" uid="uid://bh2knk60qbton" path="res://game_board/board_square_0.tscn" id="2_o5ud0"]
5-
[ext_resource type="PackedScene" uid="uid://cry3vnlah6fkx" path="res://game_board/board_square_1.tscn" id="3_a576l"]
3+
[ext_resource type="Script" path="res://game_boards/board01/game_board/GameBoard.gd" id="1_8mgoe"]
4+
[ext_resource type="PackedScene" uid="uid://bh2knk60qbton" path="res://game_boards/board01/game_board/board_square_0.tscn" id="2_o5ud0"]
5+
[ext_resource type="PackedScene" uid="uid://cry3vnlah6fkx" path="res://game_boards/board01/game_board/board_square_1.tscn" id="3_a576l"]
66

77
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_yj5kd"]
88
bg_color = Color(0, 0, 0, 0.411765)

0 commit comments

Comments
 (0)