Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tilemap support for spacing and/or margin broken since 3.80 #6823

Open
damian-pastorini opened this issue May 24, 2024 · 2 comments
Open

Tilemap support for spacing and/or margin broken since 3.80 #6823

damian-pastorini opened this issue May 24, 2024 · 2 comments

Comments

@damian-pastorini
Copy link

Version

3.80.1

  • Phaser Version:
    since 3.80
  • Operating system:
    Any
  • Browser:
    Any

Description

Since 3.80 if you try to use a Tilemap with spacing and/or margin the Tilemap displayes fully broken (tiles out of place):

image

Example Test Code

My code base is quite big by now, but it's open source, so my implementation can be see between:
https://github.com/damian-pastorini/reldens/blob/master/lib/game/client/scene-preloader.js
and
https://github.com/damian-pastorini/reldens/blob/master/lib/game/client/scene-dynamic.js

To summarize it, I'm using:

scene.load.spritesheet(imageKey, `/maps/${imageFileName}`, tileData);

And then:

scene.map.addTilesetImage(
                imageFileName,
                imageKey,
                tileData.width,
                tileData.height,
                tileData.margin,
                tileData.spacing
            )

These files will show the broken case:

reldens-house-1

These are loaded fine in the TileMapEditor app and work fine in version <=3.70.
You can see it in my demo (https://demo.reldens.com):

image

image

If I remove the margin and spacing then it works fine in >=3.80:

reldens-house-1

Additional Information

I've been using the Tile extruder and adding margin and spacing to the maps because prior to 3.80 I've always had the "extrude" issue when the player moves and then you see the lines between the tiles, but if I resize the files to their original 32x32 and remove the spacing and margin the "extrude" issue is not visible anymore, so though the spacing support is broken now I was able to avoid the original issue anyway.

Thanks for all your hard work!!!

@damian-pastorini
Copy link
Author

After further test "extrude" the tiles is still required in some cases:

image

I'm trying to fix the tileset in betwee, but getting the spacing / margin support fixed would help.

Thanks again!

@damian-pastorini
Copy link
Author

damian-pastorini commented May 25, 2024

Update: the issue is when you combine: load.spritesheet with tilemaps with spacing / margin, it just doesn't work since 3.80.

scene.load.spritesheet(imageFile, /assets/maps/${imageFile}, tileData);
scene.load.image('Desert', 'https://demo.reldens.com/assets/maps/reldens-house-1.png');

Issue visible here: https://phaser.io/sandbox/5orKEN3E switch between 3.80 and 3.70.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants