Merge pull request #3460 from Undeemiss/stanek-collision

STANEK: FIX #3277 Can no longer overlap rotated fragments
This commit is contained in:
hydroflame 2022-04-14 12:27:31 -04:00 committed by GitHub
commit 18fafff91f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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;
}