Add a condition to avoid white piece
This commit is contained in:
parent
3d4730cfc0
commit
d37059b7de
@ -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){
|
||||
|
Loading…
Reference in New Issue
Block a user