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
17 changes: 17 additions & 0 deletions src/js/SceneClasses/AnimationExecutor.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,23 @@ export default class AnimationExecutor {
);
this.executeNextCommand();
}

// Handles if candy falls off path(s)
let onPath = false;
// if the queued movement target is out of bounds (off the conveyer), console log 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);
// idk if this is the best way to check
if (end.x == value.p0.x && end.y == value.p0.y ||
end.x == value.p1.x && end.y == value.p1.y) {
onPath = true;
}
}
if (!onPath) {
console.log("***** CANDY FELL OF CONVEYER BELT *****");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

off*

alert("CANDY FELL OF CONVEYER BELT");
}
},
});
}
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