stop piece screen overflow
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is passing

This commit is contained in:
Debucquoy Anthony 2023-05-17 19:21:26 +02:00
parent 3d4730cfc0
commit b4ece0812e
Signed by: tonitch
GPG Key ID: A78D6421F083D42E

View File

@ -28,17 +28,17 @@ public class GameUI extends Group{
for (Piece p : level.getPieces()) { for (Piece p : level.getPieces()) {
MatrixShape _piece = new MatrixShape(p); MatrixShape _piece = new MatrixShape(p);
_piece.setLayoutX(piece_space.x); if(piece_space.y + _piece.boundary_size.y >= Controller.screen_size.y){
_piece.setLayoutY(piece_space.y);
piece_space.y += _piece.boundary_size.y;
if(piece_space.y >= Controller.screen_size.y){
column++; column++;
piece_space.y = SPACE_SIZE; piece_space.y = SPACE_SIZE;
piece_space.x = (SEGMENT_SIZE*3 + SPACE_SIZE*4 )* column; piece_space.x = (SEGMENT_SIZE*3 + SPACE_SIZE*4 )* column;
} }
_piece.setLayoutX(piece_space.x);
_piece.setLayoutY(piece_space.y);
piece_space.y += _piece.boundary_size.y;
// Pieces Events // Pieces Events
_piece.setOnMouseClicked(event -> { _piece.setOnMouseClicked(event -> {
if(event.getButton() == MouseButton.SECONDARY){ if(event.getButton() == MouseButton.SECONDARY){