Skip to content

Commit

Permalink
fixing parser
Browse files Browse the repository at this point in the history
  • Loading branch information
Marchand-Nicolas committed Nov 4, 2024
1 parent d0adc26 commit 53608db
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions utils/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 53608db

Please sign in to comment.