'Vertical shift' property for objects


(dmay) #1

Hi all!

Setting

I’m working on an isometric map (but same applies to orthogonal maps as well) with terrain sprites of various height. Tiled works perfectly with it, and my game engine can properly read map matrix and recognize height from tiles, and deal with all pseudo-3D physics properly. Everybody are happy in this part.

However, now I’m trying to add some objects to the map, and can’t properly handle objects, which should be placed on tall tiles.

Problem

Tiled defines coordinates for an object in 2D (obviously) and renders its sprite on these coords. But for maps, utilizing pseudo-3D and tall tiles, user could need to place an object on coords in cell (A,B), but render it higher with some ‘vertical shift’ value.

Here are two coins on my map. Bottom one is located correctly related to the map grid, and the top one is rendered in right position.

Solution?

The primary goal is to have correct X,Y coords (187,51 on the screen) in objectgroup/object section in tmx file.

I wonder if I can achieve it in Tiled right now somehow?

Or I should dig out cpp compiler and whatever they use on Macs now, and try to implement it on my own? :slight_smile:


(Thorbjørn Lindeijer) #2

The current solution Tiled provides is the “Vertical Offset” layer property. You could create an object layer at each height where you want to place objects, and set these layer’s vertical offset accordingly. It may be a little annoying to manage multiple objects layers for this, but at least the object coordinates should be easier to work with.


(dmay) #3

Thank you! It will do the trick for now.