Add a condition to avoid white piece #65
@ -6,6 +6,9 @@ import javafx.scene.paint.Paint;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
import static javafx.scene.paint.Color.WHITE;
|
||||
import static javafx.scene.paint.Color.color;
|
||||
|
||||
/**
|
||||
* Represent a Piece in the game.
|
||||
* Every Piece should be contained in a Map Object.
|
||||
@ -21,9 +24,9 @@ public class Piece extends Shape{
|
||||
public Piece(boolean[][] matrix) {
|
||||
super(matrix);
|
||||
Random rand = new Random();
|
||||
color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1);
|
||||
}
|
||||
color = new Color((rand.nextDouble()%190), (rand.nextDouble()%190), (rand.nextDouble()%190), 1);
|
||||
|
||||
|
||||
}
|
||||
public void setColor(Paint p){
|
||||
color = p;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user
https://docs.oracle.com/javase/8/docs/api/java/util/Random.html#nextDouble--
https://docs.oracle.com/javase/8/javafx/api/javafx/scene/paint/Color.html#color-double-double-double-
Les valeurs sont entre 0 et 1 et pas entre 0 et 255