1 Commits

Author SHA1 Message Date
Mat
d08d57ca78 Make a local variable with the shape
All checks were successful
continuous-integration/drone/push Build is passing
2023-05-18 01:08:34 +02:00
2 changed files with 7 additions and 6 deletions

View File

@ -7,6 +7,8 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.Random;
import static school_project.Piece.*;
public class MapGenerator {
private static final Random rand = new Random();
public enum Difficulty {
@ -93,7 +95,9 @@ public class MapGenerator {
}
}
}
ret.addPiece(new Piece(shape));
boolean[][] turnPiece = shape;
ret.addPiece(new Piece(turnPiece));
}
//generate pieces

View File

@ -6,9 +6,6 @@ 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.
@ -24,9 +21,9 @@ public class Piece extends Shape{
public Piece(boolean[][] matrix) {
super(matrix);
Random rand = new Random();
color = new Color((rand.nextDouble()%190), (rand.nextDouble()%190), (rand.nextDouble()%190), 1);
color = new Color(rand.nextDouble(), rand.nextDouble(), rand.nextDouble(), 1);
}
public void setColor(Paint p){
color = p;
}