diff --git a/app/src/main/java/school_project/Piece.java b/app/src/main/java/school_project/Piece.java index e9bdc7c..e534394 100644 --- a/app/src/main/java/school_project/Piece.java +++ b/app/src/main/java/school_project/Piece.java @@ -6,6 +6,8 @@ import javafx.scene.paint.Paint; import java.util.ArrayList; import java.util.Random; +import static javafx.scene.paint.Color.color; + /** * Represent a Piece in the game. * Every Piece should be contained in a Map Object. @@ -22,6 +24,9 @@ public class Piece extends Shape{ super(matrix); Random rand = new Random(); color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1); + while(color.equals(color(255, 255, 255))) { + color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1); + } } public void setColor(Paint p){