Search in sources :

Example 16 with LineWall

use of src.model.board.LineWall in project Labyrinthe3d by FauconFan.

the class MapIntro7 method buildOneSquareLabyrinthe.

private RectMaze buildOneSquareLabyrinthe() {
    RectMaze rl;
    ArrayList<LineWall> listWalls;
    listWalls = new ArrayList<>();
    listWalls.add(new LineWall(0, 0, 0, 7));
    listWalls.add(new LineWall(size_y, 7, size_y, 0));
    listWalls.add(new LineWall(0, 0, size_y, 0));
    listWalls.add(new LineWall(0, 7, size_y, 7));
    listWalls.add(new LineWall(1, 0, 1, 2));
    listWalls.add(new LineWall(1, 3, 1, 6));
    listWalls.add(new LineWall(2, 1, 2, 3));
    listWalls.add(new LineWall(2, 4, 2, 6));
    listWalls.add(new LineWall(2, 4, 3, 4));
    listWalls.add(new LineWall(3, 4, 3, 5));
    listWalls.add(new LineWall(3, 2, 3, 3));
    listWalls.add(new LineWall(3, 3, size_y - 3, 3));
    listWalls.add(new LineWall(4, 4, size_y - 3, 4));
    listWalls.add(new LineWall(size_y - 2, 5, size_y - 2, 2));
    listWalls.add(new LineWall(size_y - 2, 2, 3, 2));
    listWalls.add(new LineWall(1, 6, size_y - 1, 6));
    listWalls.add(new LineWall(1, 3, 2, 3));
    listWalls.add(new LineWall(size_y - 1, 2, size_y - 1, 6));
    listWalls.add(new LineWall(size_y, 1, 2, 1));
    listWalls.add(new LineWall(size_y - 2, 5, 3, 5));
    rl = new RectMaze(new ContentMazeEgg(new Case[0], listWalls.toArray(new LineWall[0])), size_y, 7);
    return (rl);
}
Also used : LineWall(src.model.board.LineWall) ContentMazeEgg(src.model.gen.ContentMazeEgg) RectMaze(src.model.gen.RectMaze)

Example 17 with LineWall

use of src.model.board.LineWall in project Labyrinthe3d by FauconFan.

the class MiniMap method makeLineWalls.

private Group makeLineWalls(LineWall[] lineWalls) {
    final Group res = new Group();
    res.getTransforms().addAll(sc2d);
    AmbientLight am = new AmbientLight(Color.WHITE);
    res.getChildren().add(am);
    for (LineWall l : lineWalls) {
        Line li = new Line(l.getX1(), -l.getY1(), l.getX2(), -l.getY2());
        li.setFill(Color.BLUE);
        li.setStrokeWidth(0.1f);
        res.getChildren().add(li);
    }
    return (res);
}
Also used : Line(javafx.scene.shape.Line) Group(javafx.scene.Group) LineWall(src.model.board.LineWall) AmbientLight(javafx.scene.AmbientLight)

Example 18 with LineWall

use of src.model.board.LineWall in project Labyrinthe3d by FauconFan.

the class CollisionsXYManager method putClosestWall.

/**
 * Cherche le mur le plus proche qui gène le déplacement.
 */
private void putClosestWall() {
    float coefProp;
    float positionEff;
    for (LineWall lw : this.walls) {
        FloatVector[][] effectWalls = lw.effWalls(this.p.getPosX(), this.p.getPosY());
        for (int i = 0; i < effectWalls.length; i++) {
            boolean horizontalWall = CollisionsXYManager.effectWallIsHorizontal(effectWalls[i]);
            if (!this.splitMove[0].isCollinearTo((effectWalls[i][1].getX() - effectWalls[i][0].getX()), (effectWalls[i][1].getY() - effectWalls[i][0].getY()))) {
                if (horizontalWall) {
                    positionEff = (this.p.getPosY() < effectWalls[i][0].getY()) ? -1 : 1;
                    coefProp = (effectWalls[i][0].getY() + this.p.getHitBoxCircle() * positionEff - this.p.getPosY()) / this.splitMove[0].getY();
                } else {
                    positionEff = (this.p.getPosX() < effectWalls[i][0].getX()) ? -1 : 1;
                    coefProp = (effectWalls[i][0].getX() + this.p.getHitBoxCircle() * positionEff - this.p.getPosX()) / this.splitMove[0].getX();
                }
                if ((coefProp < this.coefPropMin && coefProp < 1 && this.isConsideredWall(coefProp, effectWalls[i], horizontalWall)) && (0 < coefProp || (Math.abs(coefProp) < 10e-4f && ((horizontalWall && this.splitMove[0].getY() * positionEff < 0) || (!horizontalWall && this.splitMove[0].getX() * positionEff < 0))))) {
                    this.coefPropMin = coefProp;
                    this.closestWall = effectWalls[i];
                }
            }
        }
    }
}
Also used : LineWall(src.model.board.LineWall)

Aggregations

LineWall (src.model.board.LineWall)18 RectMaze (src.model.gen.RectMaze)8 ContentMazeEgg (src.model.gen.ContentMazeEgg)7 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)2 Group (javafx.scene.Group)2 ContentMaze (src.model.ContentMaze)2 FileInputStream (java.io.FileInputStream)1 Map (java.util.Map)1 Random (java.util.Random)1 AmbientLight (javafx.scene.AmbientLight)1 Image (javafx.scene.image.Image)1 Material (javafx.scene.paint.Material)1 PhongMaterial (javafx.scene.paint.PhongMaterial)1 Box (javafx.scene.shape.Box)1 Line (javafx.scene.shape.Line)1 Case (src.model.board.Case)1 EndCase (src.model.board.EndCase)1 JumpCase (src.model.board.JumpCase)1 SpeedCase (src.model.board.SpeedCase)1