diff --git a/src/main/java/Shape/Obstacle.java b/src/main/java/Shape/Obstacle.java index 9fb463a68a31bc8282e44c26049cdd40c2e2e3e0..321530ddab6f91d5adc1a935f62f367805536d5c 100644 --- a/src/main/java/Shape/Obstacle.java +++ b/src/main/java/Shape/Obstacle.java @@ -1,18 +1,12 @@ package Shape; import javafx.geometry.Bounds; -import javafx.geometry.Point3D; import javafx.scene.Group; import javafx.scene.Node; import javafx.scene.paint.Color; import javafx.scene.paint.PhongMaterial; import javafx.scene.shape.*; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Random; -import java.util.Set; - public class Obstacle { public Obstacle(int WindowSize, double xTranslation, double yTranslation, @@ -27,7 +21,7 @@ public class Obstacle { this.shape.setTranslateX(xTranslation); this.shape.setTranslateY(yTranslation); this.shape.setTranslateZ(zTranslation); - this.immovable = immovable; + this.removable = immovable; shapeBound = this.shape.getBoundsInParent(); } @@ -55,8 +49,8 @@ public class Obstacle { } public String checkCollision(Bounds otherBounds) { if (shapeBound.intersects(otherBounds)) { - if(immovable){ - return "IMMOVABLE"; + if(removable){ + return "REMOVABLE"; } double deltaX = Math.min(shapeBound.getMaxX() - otherBounds.getMinX(), otherBounds.getMaxX() - shapeBound.getMinX()); double deltaY = Math.min(shapeBound.getMaxY() - otherBounds.getMinY(), otherBounds.getMaxY() - shapeBound.getMinY()); @@ -85,7 +79,7 @@ public class Obstacle { } return "NONE"; } - boolean immovable; + boolean removable; int WindowSize = 0; double xTranslation, yTranslation, zTranslation; Node shape; diff --git a/src/main/java/org/example/newmat/GraphicsAndWindowsTest.java b/src/main/java/org/example/newmat/GraphicsAndWindowsTest.java index 3fa49f926ca8458fa9e4b217795437d50241766b..6b52f040d0417e8d89c5a88bcebe3fb13978da1e 100644 --- a/src/main/java/org/example/newmat/GraphicsAndWindowsTest.java +++ b/src/main/java/org/example/newmat/GraphicsAndWindowsTest.java @@ -347,6 +347,10 @@ public class GraphicsAndWindowsTest extends Application { if(!(collisionSide.get(0).equals("NONE"))){ Bounds obBounds = ((Obstacle) collisionSide.get(1)).getShape().getBoundsInParent(); switch ((String)collisionSide.get(0)){ + case "REMOVABLE": + Obstacle o = ((Obstacle) collisionSide.get(1)); + break; + case "LEFT": direction[i][0] = abs(direction[i][0]); break; diff --git a/target/classes/Shape/MovingObject.class b/target/classes/Shape/MovingObject.class index b14093e20c6c9a96e16661294bffc3252f808910..5ad79ff0a63f412a6d82699826faea931bc4dadc 100644 Binary files a/target/classes/Shape/MovingObject.class and b/target/classes/Shape/MovingObject.class differ