align piece when placed
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-11 11:51:53 +02:00
parent 0f1ecc753b
commit cb54e753d7
Signed by: tonitch
GPG Key ID: A78D6421F083D42E

View File

@ -63,6 +63,10 @@ public class GameUI extends Group{
(int) (_piece.getLayoutX() + (SEGMENT_SIZE+SPACE_SIZE)/2 - grid.getLayoutX())/(SEGMENT_SIZE+SPACE_SIZE) (int) (_piece.getLayoutX() + (SEGMENT_SIZE+SPACE_SIZE)/2 - grid.getLayoutX())/(SEGMENT_SIZE+SPACE_SIZE)
); );
System.out.println(level.placePiece(p, piece_position_in_grid) + piece_position_in_grid.toString()); System.out.println(level.placePiece(p, piece_position_in_grid) + piece_position_in_grid.toString());
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));
}
} }
}); });