diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000..8fe22a4 Binary files /dev/null and b/.DS_Store differ diff --git a/src/.DS_Store b/src/.DS_Store new file mode 100644 index 0000000..7603a48 Binary files /dev/null and b/src/.DS_Store differ diff --git a/src/assets/.DS_Store b/src/assets/.DS_Store new file mode 100644 index 0000000..4d77186 Binary files /dev/null and b/src/assets/.DS_Store differ diff --git a/src/assets/conveyer_photos/.DS_Store b/src/assets/conveyer_photos/.DS_Store new file mode 100644 index 0000000..cec2c43 Binary files /dev/null and b/src/assets/conveyer_photos/.DS_Store differ diff --git a/src/assets/conveyer_photos/GoalBucket.png b/src/assets/conveyer_photos/GoalBucket.png deleted file mode 100644 index 39471b6..0000000 Binary files a/src/assets/conveyer_photos/GoalBucket.png and /dev/null differ diff --git a/src/assets/conveyer_photos/blueBucket.png b/src/assets/conveyer_photos/blueBucket.png new file mode 100644 index 0000000..0737950 Binary files /dev/null and b/src/assets/conveyer_photos/blueBucket.png differ diff --git a/src/assets/conveyer_photos/blueCircle.png b/src/assets/conveyer_photos/blueCircle.png new file mode 100644 index 0000000..64bcfe3 Binary files /dev/null and b/src/assets/conveyer_photos/blueCircle.png differ diff --git a/src/assets/conveyer_photos/blueTriangle.png b/src/assets/conveyer_photos/blueTriangle.png new file mode 100644 index 0000000..c83033a Binary files /dev/null and b/src/assets/conveyer_photos/blueTriangle.png differ diff --git a/src/assets/conveyer_photos/greenBucket.png b/src/assets/conveyer_photos/greenBucket.png new file mode 100644 index 0000000..478c844 Binary files /dev/null and b/src/assets/conveyer_photos/greenBucket.png differ diff --git a/src/assets/conveyer_photos/greenCircle.png b/src/assets/conveyer_photos/greenCircle.png new file mode 100644 index 0000000..b1d2089 Binary files /dev/null and b/src/assets/conveyer_photos/greenCircle.png differ diff --git a/src/assets/conveyer_photos/greenTriangle.png b/src/assets/conveyer_photos/greenTriangle.png new file mode 100644 index 0000000..233ce3e Binary files /dev/null and b/src/assets/conveyer_photos/greenTriangle.png differ diff --git a/src/assets/conveyer_photos/redBucket.png b/src/assets/conveyer_photos/redBucket.png new file mode 100644 index 0000000..5e7ebbe Binary files /dev/null and b/src/assets/conveyer_photos/redBucket.png differ diff --git a/src/assets/conveyer_photos/redCircle.png b/src/assets/conveyer_photos/redCircle.png new file mode 100644 index 0000000..6b1a7e5 Binary files /dev/null and b/src/assets/conveyer_photos/redCircle.png differ diff --git a/src/assets/conveyer_photos/redTriangle.png b/src/assets/conveyer_photos/redTriangle.png new file mode 100644 index 0000000..43c603b Binary files /dev/null and b/src/assets/conveyer_photos/redTriangle.png differ diff --git a/src/index.html b/src/index.html index 5622d2f..d35dc74 100644 --- a/src/index.html +++ b/src/index.html @@ -58,6 +58,7 @@
Conditional:
+ diff --git a/src/js/level1.js b/src/js/level1.js index 09c8357..60ad6c4 100644 --- a/src/js/level1.js +++ b/src/js/level1.js @@ -10,6 +10,18 @@ export default class Level1 extends LevelScene { ); } + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("BlueCircle", "assets/conveyer_photos/BlueCircle.png") + this.load.image("RedCircle", "assets/conveyer_photos/RedCircle.png") + this.load.image("GreenCircle", "assets/conveyer_photos/GreenCircle.png") + } + create() { super.create(); this.addConveyorArtwork(); @@ -31,10 +43,10 @@ export default class Level1 extends LevelScene { { x: 400, y: 200, texture: "ConveyerDown" }, { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "GoalBucket" }, + { x: 200, y: 400, texture: "BlueCircle" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "GoalBucket" }, - { x: 400, y: 500, texture: "GoalBucket" }, + { x: 600, y: 400, texture: "RedCircle" }, + { x: 400, y: 500, texture: "GreenCircle" }, { x: 400, y: 400, texture: "ConveyerAll" }, ]; @@ -46,14 +58,14 @@ export default class Level1 extends LevelScene { setupLevelCandies() { const candies = [ new Candy(Colors.BLUE, Shapes.CIRCLE, Patterns.PLAIN), - new Candy(Colors.RED, Shapes.SQUARE, Patterns.PLAIN), - new Candy(Colors.GREEN, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.CIRCLE, Patterns.PLAIN), ]; const goalPositions = { "blue-circle": { x: 200, y: 400 }, // Left bin - "red-square": { x: 600, y: 400 }, // Right bin - "green-triangle": { x: 400, y: 500 }, // Bottom bin + "red-circle": { x: 600, y: 400 }, // Right bin + "green-circle": { x: 400, y: 500 }, // Bottom bin }; this.setupCandyQueue(candies, goalPositions); diff --git a/src/js/level2.js b/src/js/level2.js index 289f802..b955324 100644 --- a/src/js/level2.js +++ b/src/js/level2.js @@ -6,32 +6,37 @@ export default class Level2 extends LevelScene { super("Level2", "moveDown", false); } - create() { + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("BlueCircle", "assets/conveyer_photos/BlueCircle.png") + this.load.image("RedCircle", "assets/conveyer_photos/RedCircle.png") + this.load.image("GreenCircle", "assets/conveyer_photos/GreenCircle.png") + this.load.image("LeftBelt", "assets/conveyer_photos/LeftBelt.png") + } + + create() { super.create(); this.addConveyorArtwork(); this.graphics.setDepth(2); } - createLinesForConveyerBelt() { - this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); - this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); - this.pathManager.addLineFrom("left", "downleft", { x: 200, y: 500}); - this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); - this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); - } - addConveyorArtwork() { const tiles = [ { x: 400, y: 100, texture: "ConveyerDown" }, { x: 400, y: 200, texture: "ConveyerDown" }, { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "ConveyerCurvedLeft" }, + { x: 200, y: 400, texture: "LeftBelt" }, + { x: 200, y: 500, texture: "BlueCircle" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "GoalBucket" }, - { x: 400, y: 500, texture: "GoalBucket" }, + { x: 600, y: 400, texture: "RedCircle" }, + { x: 400, y: 500, texture: "GreenCircle" }, { x: 400, y: 400, texture: "ConveyerAll" }, - { x: 200, y: 500, texture: "GoalBucket" }, ]; tiles.forEach(({ x, y, texture }) => { @@ -39,6 +44,14 @@ export default class Level2 extends LevelScene { }); } + createLinesForConveyerBelt() { + this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); + this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); + this.pathManager.addLineFrom("left", "downleft", { x: 200, y: 500}); + this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); + this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + } + setupLevelCandies() { //Define the candies for this level const candies = [ @@ -56,5 +69,4 @@ export default class Level2 extends LevelScene { this.setupCandyQueue(candies, goalPositions); } - } diff --git a/src/js/level3.js b/src/js/level3.js index 42f032d..6e1ed2e 100644 --- a/src/js/level3.js +++ b/src/js/level3.js @@ -12,13 +12,16 @@ export default class Level3 extends LevelScene { this.graphics.setDepth(2); } - createLinesForConveyerBelt() { - this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); - this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); - this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); - this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); - this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); - this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("BlueCircle", "assets/conveyer_photos/BlueCircle.png") + this.load.image("RedCircle", "assets/conveyer_photos/RedCircle.png") + this.load.image("GreenCircle", "assets/conveyer_photos/GreenCircle.png") } addConveyorArtwork() { @@ -27,10 +30,10 @@ export default class Level3 extends LevelScene { { x: 400, y: 200, texture: "ConveyerDown" }, { x: 400, y: 300, texture: "ConveyerDown" }, { x: 300, y: 400, texture: "ConveyerLeft" }, - { x: 200, y: 400, texture: "GoalBucket" }, + { x: 200, y: 400, texture: "BlueCircle" }, { x: 500, y: 400, texture: "ConveyerRight" }, - { x: 600, y: 400, texture: "GoalBucket" }, - { x: 400, y: 500, texture: "GoalBucket" }, + { x: 600, y: 400, texture: "RedCircle" }, + { x: 400, y: 500, texture: "GreenCircle" }, { x: 400, y: 400, texture: "ConveyerAll" }, ]; @@ -39,11 +42,20 @@ export default class Level3 extends LevelScene { }); } + createLinesForConveyerBelt() { + this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); + this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); + this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); + this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); + this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + } + setupLevelCandies() { let candyOptions = [ new Candy(Colors.BLUE, Shapes.CIRCLE, Patterns.PLAIN), - new Candy(Colors.RED, Shapes.SQUARE, Patterns.PLAIN), - new Candy(Colors.GREEN, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.CIRCLE, Patterns.PLAIN), ] const goalPositions = { diff --git a/src/js/level4.js b/src/js/level4.js new file mode 100644 index 0000000..0de6c01 --- /dev/null +++ b/src/js/level4.js @@ -0,0 +1,118 @@ +import LevelScene from "./SceneClasses/LevelScene.js"; +import Candy, { Colors, Shapes, Patterns } from "./candy.js"; + +export default class Level4 extends LevelScene { + constructor() { + super( + "Level4", + "moveDown", + false, + ); + } + + preload() { + super.preload(); + this.load.image("Connector", "assets/conveyer_photos/Connector.png"); + this.load.image("ConveyerDown", "assets/conveyer_photos/ConveyerDown.png"); + this.load.image("ConveyerAll", "assets/conveyer_photos/ConnectorAll.png"); + this.load.image("ConveyerLeft", "assets/conveyer_photos/ConveyerLeft.png"); + this.load.image("ConveyerRight", "assets/conveyer_photos/ConveyerRight.png"); + this.load.image("GoalBucket", "assets/conveyer_photos/GoalBucket.png") + this.load.image("BlueBucket", "assets/conveyer_photos/BlueBucket.png") + this.load.image("RedBucket", "assets/conveyer_photos/RedBucket.png") + this.load.image("GreenBucket", "assets/conveyer_photos/GreenBucket.png") + this.load.image("blueTriangleBucket", "assets/conveyer_photos/blueTriangle.png") + this.load.image("redTriangleBucket", "assets/conveyer_photos/redTriangle.png") + this.load.image("greenTriangleBucket", "assets/conveyer_photos/greenTriangle.png") + this.load.image("blueCircleBucket", "assets/conveyer_photos/blueCircle.png") + this.load.image("redCircleBucket", "assets/conveyer_photos/redCircle.png") + this.load.image("greenCircleBucket", "assets/conveyer_photos/greenCircle.png") + } + + create() { + super.create(); + this.addConveyorArtwork(); + this.graphics.setDepth(2); + } + + addConveyorArtwork() { + const tiles = [ + { x: 400, y: 100, texture: "ConveyerDown" }, + { x: 400, y: 200, texture: "ConveyerDown" }, + { x: 400, y: 300, texture: "ConveyerDown" }, + { x: 300, y: 400, texture: "ConveyerLeft" }, + { x: 200, y: 400, texture: "ConveyerAll" }, + { x: 500, y: 400, texture: "ConveyerRight" }, + { x: 600, y: 400, texture: "ConveyerAll" }, + { x: 400, y: 500, texture: "ConveyerAll" }, + { x: 400, y: 400, texture: "ConveyerAll" }, + { x: 200, y: 500, texture: "BlueBucket" }, + { x: 200, y: 300, texture: "blueTriangleBucket" }, + { x: 100, y: 400, texture: "blueCircleBucket" }, + { x: 700, y: 400, texture: "redCircleBucket" }, + { x: 600, y: 500, texture: "RedBucket" }, + { x: 600, y: 300, texture: "redTriangleBucket" }, + { x: 300, y: 500, texture: "greenTriangleBucket" }, + { x: 400, y: 600, texture: "greenCircleBucket" }, + { x: 500, y: 500, texture: "GreenBucket" }, + ]; + + tiles.forEach(({ x, y, texture }) => { + this.add.image(x, y, texture).setDisplaySize(100, 100).setDepth(1); + }); + } + + createLinesForConveyerBelt() { + this.pathManager.addLine("center", { x: 400, y: 100 }, { x: 400, y: 400 }); + this.pathManager.addLineFrom("center", "left", { x: 200, y: 400 }); + this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); + this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + this.pathManager.addLineFrom("center", "right", { x: 600, y: 400 }); + this.pathManager.addLineFrom("center", "down", { x: 400, y: 500 }); + this.pathManager.addLineFrom("left", "leftUp", {x: 200, y: 300}); + this.pathManager.addLineFrom("left", "leftDown", {x: 200, y: 500}); + this.pathManager.addLineFrom("left", "leftLeft", {x: 100, y: 400}); + this.pathManager.addLineFrom("right", "rightUp", {x: 600, y: 300}); + this.pathManager.addLineFrom("right", "rightDown", {x: 600, y: 500}); + this.pathManager.addLineFrom("right", "rightLeft", {x: 700, y: 400}); + this.pathManager.addLineFrom("down", "downDown", {x: 400, y: 600}); + this.pathManager.addLineFrom("down", "downLeft", {x: 300, y: 500}); + this.pathManager.addLineFrom("down", "downRight", {x: 500, y: 500}); + } + + setupLevelCandies() { + let candyOptions = [ + new Candy(Colors.BLUE, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.BLUE, Shapes.SQUARE, Patterns.PLAIN), + new Candy(Colors.BLUE, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.SQUARE, Patterns.PLAIN), + new Candy(Colors.RED, Shapes.TRIANGLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.CIRCLE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.SQUARE, Patterns.PLAIN), + new Candy(Colors.GREEN, Shapes.TRIANGLE, Patterns.PLAIN), + ]; + + const goalPositions = { + "blue-circle": { x: 100, y: 400 }, + "blue-square": { x: 200, y: 500 }, + "blue-triangle": { x: 200, y: 300 }, + "red-circle": { x: 700, y: 400 }, + "red-square": { x: 600, y: 500 }, + "red-triangle": { x: 600, y: 300 }, + "green-circle": { x: 400, y: 600 }, + "green-square": { x: 500, y: 500 }, + "green-triangle": { x: 300, y: 500 }, + }; + + let candies = []; + + for(let i = 0; i < 3; i++){ + let nextCandy = candyOptions[Math.floor(Math.random() * candyOptions.length)]; + candies.push(nextCandy); + candyOptions = candyOptions.filter(option => option !== nextCandy); + } + + this.setupCandyQueue(candies, goalPositions); + } +} \ No newline at end of file diff --git a/src/js/main.js b/src/js/main.js index 59ea1cb..941ef00 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -1,6 +1,7 @@ import Level1 from './level1.js'; import Level2 from './level2.js'; import Level3 from './level3.js'; +import Level4 from './level4.js'; //Here, we import the level files. //Later, we'll want to abstract this process into a function or switch case to call specific levels. @@ -23,7 +24,7 @@ const config = { dom: { createContainer: true, }, - scene: [Level1, Level2, Level3] + scene: [Level1, Level2, Level3, Level4] }; //Setting up the theme for the text editor @@ -58,6 +59,7 @@ levelSelect.addEventListener('change', (event) => { console.log('Level1'); game.scene.stop('Level2'); game.scene.stop('Level3'); + game.scene.stop('Level4'); game.scene.start(scene); break; case '2': @@ -65,6 +67,7 @@ levelSelect.addEventListener('change', (event) => { console.log('Level2'); game.scene.stop('Level1'); game.scene.stop('Level3'); + game.scene.stop('Level4'); game.scene.start(scene); break; // Add more cases for additional levels later when added @@ -73,12 +76,22 @@ levelSelect.addEventListener('change', (event) => { console.log('Level3'); game.scene.stop('Level1'); game.scene.stop('Level2'); + game.scene.stop('Level4'); + game.scene.start(scene); + break; + case '4': + scene = 'Level4'; + console.log('Level4'); + game.scene.stop('Level1'); + game.scene.stop('Level2'); + game.scene.stop('Level3'); game.scene.start(scene); break; default: scene = 'Level1'; game.scene.stop('Level2'); game.scene.stop('Level3'); + game.scene.stop('Level4'); game.scene.start(scene); break; }