Different Issues (alpha, positioning)

Hi there!

I am developing a defrac version to render the tmx format. There are some things, I cannot get my head around.

  • The alpha value of the map-background is not emitted to the json-format, which I use.
  • How to position tiles from a tileset that are larger or smaller then the root tile-size. I suspect that there is a bug when changing the the render-order. Should the render-order be involved into the positioning of the tiles anyway? Given that my root tilesize is 16px and my tileset is 32px, I would assume that for “right-down” the pivot of the tile is right-down to protect the z-sorting, but it does not change when I change the render-order of the map. Right now in my test it only goes 16px up. I do not know where to get this offset.
  • Giving that there is render-order, is there a concept of rendering Sprites correctly according to its depth?


  • It would be nice to have different layer sizes to have a parallax scrolling effect. Things would move faster or slower regarding to its layer dimensions.

Cheers, André Michelle

Nice, interesting project! I recently read about defrac I think because it was linked from the audiotool.com blog and it sounded quite interesting.

I consider being able to edit the alpha value a bug in the Tiled UI, which is just a bit involved to do something about. I just hope nobody relies on this value in the meantime. The thing is that having an alpha value in the map background does not make sense, given that it is supposed to provide a background color of the map.

Tiles and tile objects both are bottom-left aligned. For tiles this means the bottom-left of the graphic stays in the bottom-left of the cell when the image is bigger. For tile objects, it means the bottom-left of the image sits at their position. This position is also their rotation origin.

This is inconsistent with rectangle and ellipse objects, which have their position in the top-left, and I consider this a judgement error on my part early on in Tiled, caused by a bias towards top-down games where sprites are generally bottom-aligned. Eventually an alignment option may be introduced.

The render order has two modes:

  • index: Render the objects based on their “depth”, which is defined by when they appear in the list of objects (their index). In this mode, the user can manually control the stacking order in Tiled using the context menu or shortcuts.
  • topdown: Render the objects from top to bottom, sorted by their y position.

Requests for parallax support has come up before and is definitely something I’m interested in adding, as well as support for different layer sizes (and different tile grids per layer).

Good luck with your project, and please keep asking if you have more questions!

Thank you for the response! I think I got it.

You can watch the current code here.
Or directly in your browser.

It would be very helpful to have test-projects to compare the results.

That demo looks great!

For sure test projects would be useful, and it’s been requested before of course. Still something I need to get around to eventually…