From 53608dbc8b96e28a9341ab40ca75b5b93bf53242 Mon Sep 17 00:00:00 2001 From: Nico <60229704+Marchand-Nicolas@users.noreply.github.com> Date: Mon, 4 Nov 2024 22:35:11 +0100 Subject: [PATCH] fixing parser --- utils/parser.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/utils/parser.ts b/utils/parser.ts index 95987656..efa96728 100644 --- a/utils/parser.ts +++ b/utils/parser.ts @@ -122,10 +122,10 @@ export class LdtkReader { (t) => t.uid === entity?.tileRect.tilesetUid ); if (!entity || !tileset) return; - let spritesPerRow = tileset?.pxWid / tileset?.tileGridSize ?? 1; - let spritesPerColumn = tileset?.pxHei / tileset?.tileGridSize ?? 1; - let xIndex = entity?.tileRect.x / tileset?.tileGridSize ?? 0; - let yIndex = entity?.tileRect.y / tileset?.tileGridSize ?? 0; + let spritesPerRow = tileset?.pxWid / tileset?.tileGridSize; + let spritesPerColumn = tileset?.pxHei / tileset?.tileGridSize; + let xIndex = entity?.tileRect.x / tileset?.tileGridSize; + let yIndex = entity?.tileRect.y / tileset?.tileGridSize; let xOffset = xIndex / spritesPerRow; let yOffset = 1 - (yIndex + (entity?.tileRect.h ?? 0) / 16) / spritesPerColumn;