Skip to content
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
Binary file added .DS_Store
Binary file not shown.
Binary file added src/.DS_Store
Binary file not shown.
Binary file added src/assets/.DS_Store
Binary file not shown.
Binary file added src/assets/conveyer_photos/.DS_Store
Binary file not shown.
Binary file removed src/assets/conveyer_photos/GoalBucket.png
Binary file not shown.
Binary file added src/assets/conveyer_photos/blueBucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/blueCircle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/blueTriangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/greenBucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/greenCircle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/greenTriangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/redBucket.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/redCircle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/assets/conveyer_photos/redTriangle.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ <h5>Conditional:</h5>
<option value="1" selected>Level 1</option>
<option value="2">Level 2</option>
<option value="3">Level 3</option>
<option value="4">Level 4</option>
</select>
</form>
</nav>
Expand Down
26 changes: 19 additions & 7 deletions src/js/level1.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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" },
];

Expand All @@ -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);
Expand Down
40 changes: 26 additions & 14 deletions src/js/level2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,52 @@ 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 }) => {
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("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 = [
Expand All @@ -56,5 +69,4 @@ export default class Level2 extends LevelScene {

this.setupCandyQueue(candies, goalPositions);
}

}
36 changes: 24 additions & 12 deletions src/js/level3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -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" },
];

Expand All @@ -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 = {
Expand Down
118 changes: 118 additions & 0 deletions src/js/level4.js
Original file line number Diff line number Diff line change
@@ -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);
}
}
15 changes: 14 additions & 1 deletion src/js/main.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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
Expand Down Expand Up @@ -58,13 +59,15 @@ 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':
scene = 'Level2';
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
Expand All @@ -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;
}
Expand Down