diff --git a/game/src/Taquin.gd b/game/src/Taquin.gd index c56f386..639340c 100644 --- a/game/src/Taquin.gd +++ b/game/src/Taquin.gd @@ -8,19 +8,27 @@ export var width: int = 512 export var height: int = 512 var pieces: Array = [] +var missing_piece: Vector2 func _draw() -> void: draw_rect(Rect2(0, 0, width, height), Color.blue) func _ready() -> void: - for r in range(rows): - for c in range(columns): - if r == rows - 1 && c == columns - 1: - continue + for c in range(columns): + var pieces_row: Array = [] + for r in range(rows): + var piece = Piece.new() var padding_w = (width - (piece.size * columns)) / (columns + 1) var padding_h = (height - (piece.size * rows)) / (rows + 1) var initial_position = Vector2(padding_w + c * (piece.size + padding_w), padding_h + r * (piece.size + padding_h)) piece.translate(initial_position) + + if r == rows - 1 && c == columns - 1: + piece.visible = false + missing_piece.x = c + missing_piece.y = r + add_child(piece) - pieces.append(piece) \ No newline at end of file + pieces_row.append(piece) + pieces.append(pieces_row) \ No newline at end of file