Commit e54cde7c authored by Sergio Emanuel Rodriguez Rivera's avatar Sergio Emanuel Rodriguez Rivera
Browse files

renamed immovable

parent 1d809691
Loading
Loading
Loading
Loading
+4 −10
Original line number Diff line number Diff line
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;
+4 −0
Original line number Diff line number Diff line
@@ -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;
+138 B (6.1 KiB)

File changed.

No diff preview for this file type.