Merge pull request '#3. /JL' (#5) from 0.0.4 into main

Reviewed-on: #5
This commit was merged in pull request #5.
This commit is contained in:
2025-12-06 16:43:46 +01:00

View File

@@ -201,16 +201,27 @@ func _lock_piece() -> void:
func _clear_full_lines() -> int:
var cleared_lines := 0
for y in range(BOARD_HEIGHT - 1, -1, -1):
var y := BOARD_HEIGHT - 1
while y >= 0:
var is_full := true
for x in range(BOARD_WIDTH):
if grid[y][x] == "":
is_full = false
break
if is_full:
# Remove this row and drop everything above it down by 1
_drop_lines_above(y)
cleared_lines += 1
y += 1 # re-check same row index (now replaced)
# IMPORTANT:
# Do NOT change y here.
# After dropping, a new row has moved into index y,
# so we re-check the same y in the next loop iteration.
else:
# Only move up when the current row was not cleared
y -= 1
return cleared_lines
func _drop_lines_above(row: int) -> void: