-
-
Notifications
You must be signed in to change notification settings - Fork 640
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
Add support for tilewidth & tileheight delta between tileset and map (eg. "perspective" map) #105
Comments
Concerning the attempted fix, it also forces to add the following line to avoid an exception when reaching the end of the map : I just checked as well how this is managed in Tiled, and basically endX/endY are calculated doing : which if I'm not wrong is the same thing that I did, so no better solution there :) |
One more comment : as far as I know, these boundaries issues are only visible with perspective maps, if so, the question is to know how much code we are ready to add "just" for perspective maps (is there anyone actually using it?) |
I think it's more general than just "perspective" maps, because the feature that allows this trouble is mixing different tile sizes. It's actually possible to have several tilesets all with different tile sizes: bigger and smaller than the map tile size. I think it's really uncommon, and can be left unimplemented until it's needed. As for fixing, you gave me an idea in the other thread to use canvas.clip() with a rectangle specified by the rect passed to This will have some performance implications. So when implemented, it should be done with the caveat that it's a "slow path". Maybe issue a warning saying different tile sizes are supported, but it's slow. |
… tileset - See platformer2 for an example; this bug appears while scrolling
Wow, old one finally fixed! |
Wow, i was not even remembering that one :) good fix ! |
When the tile size (tilewidth & tileheight) is not the same in both the map and the tileset(s), strange things can happen. I created a map which uses a tile size of 8x8 pixels, and a tileset which uses 64x64 pixels. The result is that MAP TILES which are not within the viewport are hidden. Keep in mind that the map tiles are smaller than tileset tiles, so when arranged on a map, the tileset tiles overlap.
Here's the map that shows this bug: https://raw.github.com/gist/3704305/5ceb4302d5a2719728fa44c33a5dfb4111fb30f1/tile_sizes.tmx This TMX can be saved to the
examples/tiled_example_loader/data/
directory and loaded there.An attempted fix was made in: f965bf4#src/level/TMXRenderer.js But it only works around the problem, by fixing cases where the tileset tiles are up to 2x larger than map tiles. And it also causes larger map layer rectangles to be drawn than necessary in the common case.
The text was updated successfully, but these errors were encountered: