excaliburjs / excalibur-tiled

Adds Tiled Map Editor File support to Excalibur
https://excaliburjs.com/docs/tiled-plugin
BSD 2-Clause "Simplified" License
50 stars 22 forks source link

margin seems to be ignored #443

Closed max-vogler closed 1 year ago

max-vogler commented 1 year ago

Steps to Reproduce

Import a Tiled map using a Tiled tileset loading a single image with a margin (e.g. 8 pixels of blank space around the tiles, don't confuse with spacing between the tiles).

Expected Result

excalibur-tiled should load the tileset correctly.

Actual Result

excalibur-tiled loads the tiles in a garbled way, some are transparent, some are the wrong tiles.

Environment

Current Workaround

Creating a new tileset in Tiled without margin works.

eonarheim commented 1 year ago

@max-vogler Thanks for the issue! Definitely unexpected

Is this the margin you're setting in Tiled?

image
max-vogler commented 1 year ago

Yes, exactly! Excuse the short bug report without code/reproduction. My problem was solved after re-doing the tileset without margin and I don't see margin being used in the plugin code.

eonarheim commented 1 year ago

Hopefully a quick fix 🤞 I distinctly remember writing this type of thing for spritesheets in the main repo

eonarheim commented 1 year ago

@max-vogler Think I've got this figured! Excalibur uses the same words as Tiled for different things haha! Also we were note interpreting Tiled's concept of margin into Excalibur.

max-vogler commented 1 year ago

Hey thank you so much for the quick fix, love the fast turnaround time! I left a short comment in https://github.com/excaliburjs/excalibur-tiled/commit/0fe3031cfa37f16e42221519095bf84a1b00c9f4#r120139294, because I think there might still be a bug related to applying Tiled margin on the right and bottom side, which is not captured by Excalibur's originOffset.