From f480e8a78359596f3b1025dbaef26d80934dc5a2 Mon Sep 17 00:00:00 2001 From: Anthony Debucquoy Date: Thu, 18 May 2023 20:17:17 +0200 Subject: [PATCH] Draw the piece at their places at the start of the level --- app/src/main/java/school_project/GameUI.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/app/src/main/java/school_project/GameUI.java b/app/src/main/java/school_project/GameUI.java index b06f966..e6cfe0d 100644 --- a/app/src/main/java/school_project/GameUI.java +++ b/app/src/main/java/school_project/GameUI.java @@ -43,6 +43,11 @@ public class GameUI extends Group{ piece_space.y += _piece.boundary_size.y; + if(p.getPosition() != null){ + _piece.setLayoutX(grid.getLayoutX() + p.getPosition().y * (SEGMENT_SIZE+SPACE_SIZE)); + _piece.setLayoutY(grid.getLayoutY() + p.getPosition().x * (SEGMENT_SIZE+SPACE_SIZE)); + } + // Pieces Events _piece.setOnMouseClicked(event -> { if(event.getButton() == MouseButton.SECONDARY){