deleting piece position when clicked to avoid fantom pieces #63

Merged
tonitch merged 1 commits from pieceOverlap into master 2023-05-17 23:41:56 +02:00

View File

@ -58,6 +58,7 @@ public class GameUI extends Group{
_piece.setOnMouseReleased(event -> { _piece.setOnMouseReleased(event -> {
if(event.getButton() != MouseButton.PRIMARY) if(event.getButton() != MouseButton.PRIMARY)
return; return;
p.setPosition(null);
if(event.getSceneX() > grid.getLayoutX() && event.getSceneX() < grid.getLayoutX() + grid.boundary_size.x if(event.getSceneX() > grid.getLayoutX() && event.getSceneX() < grid.getLayoutX() + grid.boundary_size.x
&& event.getSceneY() > grid.getLayoutY() && event.getSceneY() < grid.getLayoutY() + grid.boundary_size.y ) && event.getSceneY() > grid.getLayoutY() && event.getSceneY() < grid.getLayoutY() + grid.boundary_size.y )
{ {