DownDate to java 11
Some checks failed
continuous-integration/drone/push Build is failing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Debucquoy Anthony 2023-05-04 22:12:13 +02:00
parent a796fbf504
commit 507437298b
Signed by: tonitch
GPG Key ID: A78D6421F083D42E
4 changed files with 21 additions and 12 deletions

View File

@ -20,13 +20,19 @@ public class MapGenerator {
// define map size depending on the difficulty
switch (difficulty){
case Easy -> map_size = new Vec2(rand.nextInt(3, 5), rand.nextInt(3, 5));
case Medium -> map_size = new Vec2(rand.nextInt(5, 8), rand.nextInt(5, 8));
case Difficult -> {
map_size = new Vec2(rand.nextInt(8, 10), rand.nextInt(8, 10));
case Easy:
map_size = new Vec2(rand.nextInt(2) + 3, rand.nextInt(2) + 3);
break;
case Medium:
map_size = new Vec2(rand.nextInt(3)+5, rand.nextInt(3)+5);
break;
case Difficult:
map_size = new Vec2(rand.nextInt(2)+8, rand.nextInt(2)+8);
depth = 2;
}
default -> map_size = new Vec2();
break;
default:
map_size = new Vec2();
break;
}
// Cut edges
@ -57,7 +63,7 @@ public class MapGenerator {
while (EmptySlots.size() > 0){
Collections.shuffle(EmptySlots);
Vec2 selected = EmptySlots.get(0);
int size = rand.nextInt(1, 4);
int size = rand.nextInt(3)+1;
boolean[][] shape = new boolean[size][size];
for(int i = 0; i < size; i++){
for (int j = 0; j < size; j++) {

View File

@ -68,7 +68,8 @@ public class Piece extends Shape{
@Override
public boolean equals(Object obj) {
if(obj instanceof Piece pieceObj){
if(obj instanceof Piece){
Piece pieceObj = (Piece) obj;
if( pieceObj.getPosition().equals(this.getPosition()) && pieceObj.getShape().equals(getShape())) {
return true;
}

View File

@ -1,6 +1,5 @@
package school_project.Utils;
import javafx.geometry.Rectangle2D;
import javafx.scene.Node;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;
@ -19,7 +18,8 @@ public class MatrixShape extends GridPane {
public MatrixShape(Shape shape) {
super();
this.shape = shape;
if(shape instanceof Piece p){
if(shape instanceof Piece){
Piece p = (Piece) shape;
color = p.getColor();
}
@ -36,7 +36,8 @@ public class MatrixShape extends GridPane {
for (int j = 0; j < shape_matrix[i].length; j++) {
if(shape_matrix[i][j]){
Node _cell;
if(shape instanceof Piece p){
if(shape instanceof Piece){
Piece p = (Piece) shape;
_cell = new Rectangle(GameUI.SEGMENT_SIZE, GameUI.SEGMENT_SIZE);
((Rectangle) _cell).setFill(color);
}else{

View File

@ -21,7 +21,8 @@ public class Vec2 implements Serializable {
@Override
public boolean equals(Object obj) {
if (obj instanceof Vec2 vec) {
if (obj instanceof Vec2) {
Vec2 vec = (Vec2) obj;
return this.x == vec.x && this.y == vec.y;
}
return false;