From 57ea3aee39f5239743a9b109667153aa67838131 Mon Sep 17 00:00:00 2001 From: royd2023 Date: Mon, 2 Feb 2026 21:58:18 -0500 Subject: [PATCH 1/2] added console log whenever candy falls off path --- src/js/SceneClasses/AnimationExecutor.js | 16 ++++++++++++++++ src/js/level1.js | 3 +-- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/js/SceneClasses/AnimationExecutor.js b/src/js/SceneClasses/AnimationExecutor.js index f307be0..15cdbeb 100644 --- a/src/js/SceneClasses/AnimationExecutor.js +++ b/src/js/SceneClasses/AnimationExecutor.js @@ -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() { diff --git a/src/js/level1.js b/src/js/level1.js index d12d189..c30165b 100644 --- a/src/js/level1.js +++ b/src/js/level1.js @@ -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() { From a8afa22a740fa82750cc6452ceb58ba3e8e03fcf Mon Sep 17 00:00:00 2001 From: royd2023 Date: Mon, 9 Feb 2026 19:19:10 -0500 Subject: [PATCH 2/2] popup when candy falls off functionality --- src/js/SceneClasses/AnimationExecutor.js | 33 ++++++++++++------------ 1 file changed, 17 insertions(+), 16 deletions(-) diff --git a/src/js/SceneClasses/AnimationExecutor.js b/src/js/SceneClasses/AnimationExecutor.js index 15cdbeb..03e6718 100644 --- a/src/js/SceneClasses/AnimationExecutor.js +++ b/src/js/SceneClasses/AnimationExecutor.js @@ -25,22 +25,6 @@ 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() { @@ -168,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 *****"); + alert("CANDY FELL OF CONVEYER BELT"); + } }, }); }