Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

maze.addWall accepts data now additionaly to wall instance #9

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 5 additions & 14 deletions app/examples/example.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,26 +34,17 @@ function start() {
maze.addItem(cube);
maze.addItem(fireball);

const simple_wall_front = Wall.create({x: 1, z: 2, orientation: 'front'});
const simple_wall_right = Wall.create({x: 1, z: 2, orientation: 'right'});
const simple_wall_back = Wall.create({x: 1, z: 2, orientation: 'back'});
maze.addWall(simple_wall_front);
maze.addWall(simple_wall_right);
maze.addWall(simple_wall_back);
maze.addWall({x: 1, z: 2, orientation: 'front'});
maze.addWall({x: 1, z: 2, orientation: 'right'});
maze.addWall({x: 1, z: 2, orientation: 'back' });
maze.addWall({x: 3, z: 0, orientation: 'right', texture: WallTexture.HEDGE});
maze.addWall({x: 3, z: 0, orientation: 'front', texture: WallTexture.LAMP});

const portal = Wall.create({x: 3, z: 0, orientation: 'back'});
portal.setTexture(WallTexture.GATE);
portal.isPortalTo({x: 2, z: 0});
maze.addWall(portal);

const hedge = Wall.create({x: 3, z: 0, orientation: 'right'});
hedge.setTexture(WallTexture.HEDGE);
maze.addWall(hedge);

const lamp = Wall.create({x: 3, z: 0, orientation: 'front'});
lamp.setTexture(WallTexture.LAMP);
maze.addWall(lamp);

maze.start();

}
Expand Down
67 changes: 33 additions & 34 deletions app/examples/gotham_city.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ function start() {
const batmobile = Item.createCube({x: 4, z: 4, displayName: 'batmobile'});

const portal = Wall.create({x: 4, z: 2, orientation: 'right', texture: WallTexture.GATE});
portal.setTexture(WallTexture.GATE);
portal.isPortalTo({x: 3, z: 4});

const portalBack = Wall.create({x: 3, z: 4, orientation: 'back', texture: WallTexture.GATE});
Expand All @@ -54,39 +53,39 @@ function start() {

maze.addWall(portal);
maze.addWall(portalBack);
maze.addWall(Wall.create({x: 0, z: 0, orientation: 'right'}));
maze.addWall(Wall.create({x: 1, z: 0, orientation: 'right'}));
maze.addWall(Wall.create({x: 2, z: 0, orientation: 'front'}));
maze.addWall(Wall.create({x: 4, z: 1, orientation: 'right'}));
maze.addWall(Wall.create({x: 1, z: 1, orientation: 'right'}));
maze.addWall(Wall.create({x: 3, z: 1, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 1, orientation: 'right'}));
maze.addWall(Wall.create({x: 0, z: 2, orientation: 'front'}));
maze.addWall(Wall.create({x: 1, z: 2, orientation: 'right'}));
maze.addWall(Wall.create({x: 2, z: 2, orientation: 'right'}));
maze.addWall(Wall.create({x: 2, z: 2, orientation: 'front'}));
maze.addWall(Wall.create({x: 4, z: 2, orientation: 'front'}));
maze.addWall(Wall.create({x: 5, z: 2, orientation: 'right'}));
maze.addWall(Wall.create({x: 0, z: 3, orientation: 'front'}));
maze.addWall(Wall.create({x: 1, z: 3, orientation: 'right'}));
maze.addWall(Wall.create({x: 3, z: 3, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 3, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 3, orientation: 'left'}));
maze.addWall(Wall.create({x: 0, z: 4, orientation: 'right'}));
maze.addWall(Wall.create({x: 1, z: 4, orientation: 'front'}));
maze.addWall(Wall.create({x: 2, z: 4, orientation: 'right'}));
maze.addWall(Wall.create({x: 2, z: 4, orientation: 'front'}));
maze.addWall(Wall.create({x: 3, z: 4, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 4, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 4, orientation: 'front'}));
maze.addWall(Wall.create({x: 0, z: 5, orientation: 'right', texture: WallTexture.HEDGE}));
maze.addWall(Wall.create({x: 1, z: 5, orientation: 'right', texture: WallTexture.HEDGE}));
maze.addWall(Wall.create({x: 2, z: 5, orientation: 'right', texture: WallTexture.HEDGE}));
maze.addWall(Wall.create({x: 3, z: 5, orientation: 'right', texture: WallTexture.HEDGE}));
maze.addWall(Wall.create({x: 4, z: 5, orientation: 'right', texture: WallTexture.HEDGE}));
maze.addWall(Wall.create({x: 5, z: 5, orientation: 'front', texture: WallTexture.HEDGE}));
maze.addWall(Wall.create({x: 5, z: 4, orientation: 'front', texture: WallTexture.HEDGE}));
maze.addWall(Wall.create({x: 5, z: 3, orientation: 'front', texture: WallTexture.HEDGE}));
maze.addWall({x: 0, z: 0, orientation: 'right'});
maze.addWall({x: 1, z: 0, orientation: 'right'});
maze.addWall({x: 2, z: 0, orientation: 'front'});
maze.addWall({x: 4, z: 1, orientation: 'right'});
maze.addWall({x: 1, z: 1, orientation: 'right'});
maze.addWall({x: 3, z: 1, orientation: 'right'});
maze.addWall({x: 4, z: 1, orientation: 'right'});
maze.addWall({x: 0, z: 2, orientation: 'front'});
maze.addWall({x: 1, z: 2, orientation: 'right'});
maze.addWall({x: 2, z: 2, orientation: 'right'});
maze.addWall({x: 2, z: 2, orientation: 'front'});
maze.addWall({x: 4, z: 2, orientation: 'front'});
maze.addWall({x: 5, z: 2, orientation: 'right'});
maze.addWall({x: 0, z: 3, orientation: 'front'});
maze.addWall({x: 1, z: 3, orientation: 'right'});
maze.addWall({x: 3, z: 3, orientation: 'right'});
maze.addWall({x: 4, z: 3, orientation: 'right'});
maze.addWall({x: 4, z: 3, orientation: 'left' });
maze.addWall({x: 0, z: 4, orientation: 'right'});
maze.addWall({x: 1, z: 4, orientation: 'front'});
maze.addWall({x: 2, z: 4, orientation: 'right'});
maze.addWall({x: 2, z: 4, orientation: 'front'});
maze.addWall({x: 3, z: 4, orientation: 'right'});
maze.addWall({x: 4, z: 4, orientation: 'right'});
maze.addWall({x: 4, z: 4, orientation: 'front'});
maze.addWall({x: 0, z: 5, orientation: 'right', texture: WallTexture.HEDGE});
maze.addWall({x: 1, z: 5, orientation: 'right', texture: WallTexture.HEDGE});
maze.addWall({x: 2, z: 5, orientation: 'right', texture: WallTexture.HEDGE});
maze.addWall({x: 3, z: 5, orientation: 'right', texture: WallTexture.HEDGE});
maze.addWall({x: 4, z: 5, orientation: 'right', texture: WallTexture.HEDGE});
maze.addWall({x: 5, z: 5, orientation: 'front', texture: WallTexture.HEDGE});
maze.addWall({x: 5, z: 4, orientation: 'front', texture: WallTexture.HEDGE});
maze.addWall({x: 5, z: 3, orientation: 'front', texture: WallTexture.HEDGE});

maze.addPlayer(player);
maze.start();
Expand Down
34 changes: 17 additions & 17 deletions app/examples/portalExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,22 @@ function start () {
});
maze.addItem(cubeBlue);

maze.addWall(Wall.create({x: 0, z: 0, orientation: 'right'}));
maze.addWall(Wall.create({x: 1, z: 0, orientation: 'right'}));
maze.addWall(Wall.create({x: 2, z: 0, orientation: 'right'}));
maze.addWall(Wall.create({x: 3, z: 0, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 1, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 1, orientation: 'right'}));
maze.addWall(Wall.create({x: 4, z: 1, orientation: 'back'}));
maze.addWall(Wall.create({x: 4, z: 3, orientation: 'back'}));
maze.addWall(Wall.create({x: 4, z: 3, orientation: 'left'}));
maze.addWall(Wall.create({x: 3, z: 2, orientation: 'back'}));
maze.addWall(Wall.create({x: 3, z: 3, orientation: 'back'}));
maze.addWall(Wall.create({x: 3, z: 4, orientation: 'back'}));
maze.addWall(Wall.create({x: 2, z: 2, orientation: 'back'}));
maze.addWall(Wall.create({x: 2, z: 3, orientation: 'back'}));
maze.addWall(Wall.create({x: 2, z: 4, orientation: 'back'}));
maze.addWall(Wall.create({x: 0, z: 1, orientation: 'right'}));
maze.addWall({x: 0, z: 0, orientation: 'right'});
maze.addWall({x: 1, z: 0, orientation: 'right'});
maze.addWall({x: 2, z: 0, orientation: 'right'});
maze.addWall({x: 3, z: 0, orientation: 'right'});
maze.addWall({x: 4, z: 1, orientation: 'right'});
maze.addWall({x: 4, z: 1, orientation: 'right'});
maze.addWall({x: 4, z: 1, orientation: 'back'});
maze.addWall({x: 4, z: 3, orientation: 'back'});
maze.addWall({x: 4, z: 3, orientation: 'left'});
maze.addWall({x: 3, z: 2, orientation: 'back'});
maze.addWall({x: 3, z: 3, orientation: 'back'});
maze.addWall({x: 3, z: 4, orientation: 'back'});
maze.addWall({x: 2, z: 2, orientation: 'back'});
maze.addWall({x: 2, z: 3, orientation: 'back'});
maze.addWall({x: 2, z: 4, orientation: 'back'});
maze.addWall({x: 0, z: 1, orientation: 'right'});
const portal1 = Wall.create({x: 4, z: 0, orientation: 'right'});
portal1.setTexture(WallTexture.GATE);
portal1.isPortalTo({x: 4, z: 2});
Expand All @@ -70,4 +70,4 @@ function start () {

}

export default {start};
export default {start};
4 changes: 2 additions & 2 deletions app/maze/mazen.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class MazeTemplate {
});
}

addWall(wall) {

addWall(wallData) {
const wall = Wall.isPrototypeOf (wallData) ? wallData : Wall.create (wallData);
const wallMesh = wall.getMesh();

this.scene.add(wallMesh);
Expand Down