From 749b93608b9697fa0edc181a1f8ecfec6eb250b7 Mon Sep 17 00:00:00 2001 From: Undeemiss Date: Thu, 14 Apr 2022 11:13:50 -0500 Subject: [PATCH] Fixed Stanek fragment collision detection Relaxed some overzealous short-circuiting to ensure fragments on the Stanek's Gift board properly check for collisions. --- src/CotMG/ActiveFragment.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/CotMG/ActiveFragment.ts b/src/CotMG/ActiveFragment.ts index ac46d40e3..0a7d7e44b 100644 --- a/src/CotMG/ActiveFragment.ts +++ b/src/CotMG/ActiveFragment.ts @@ -40,8 +40,9 @@ export class ActiveFragment { // These 2 variables converts 'this' local coordinates to world to other local. const dx: number = other.x - this.x; const dy: number = other.y - this.y; - for (let j = 0; j < thisFragment.shape.length; j++) { - for (let i = 0; i < thisFragment.shape[j].length; i++) { + const fragSize = Math.max(thisFragment.shape.length, thisFragment.shape[0].length); + for (let j = 0; j < fragSize; j++) { + for (let i = 0; i < fragSize; i++) { if (thisFragment.fullAt(i, j, this.rotation) && otherFragment.fullAt(i - dx, j - dy, other.rotation)) return true; }