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
16 changes: 16 additions & 0 deletions src/js/SceneClasses/AnimationExecutor.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,22 @@ export default class AnimationExecutor {
console.log(
`[AnimationExecutor] Queued movement to (${targetPosition.x}, ${targetPosition.y}). Queue size: ${this.commandQueue.length}`,
);

let onPath = false;
// if the queued movement target is out of bounds (off the conveyer), display a popup for now
for (const value of Object.values(this.pathManager.lines)) {
console.log("Start:", value.p0.x, value.p0.y);
console.log("End:", value.p1.x, value.p1.y);
if (targetPosition.x == value.p0.x && targetPosition.y == value.p0.y ||
targetPosition.x == value.p1.x && targetPosition.y == value.p1.y) {
onPath = true;
}
}

if (!onPath) {
console.log("Candy fell of conveyer belt");
}

}

queueCandyDump() {
Expand Down
3 changes: 1 addition & 2 deletions src/js/level1.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@ export default class Level1 extends Phaser.Scene {
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', 'leftDown', { x: 400, y: 500 });
// this.pathManager.addLineFrom('center', 'rightDown', { x: 600, y: 150 });
this.pathManager.addLineFrom('center', 'down', { x: 400, y: 500 });
}

createIncrementalCommands() {
Expand Down