Yes. Tiled is using an offset for the vertex positions.
You will need to extract that offset (it should be in the record) and add it to (or subtract it from) the line vertices.
You may also be dealing with relative offset that you’ll need to calculate.
I wish I could give you a better answer, but in my experience, this offsetting varies in Tiled.
- Polygons use one style
- Physics bodies use another
- Lines may use yet another.
RGTiiled handles polygons here: https://github.com/roaminggamer/SSK2/blob/master/ssk2/tiledLoader.lua (221 … 232 )
Notice the use of this SSK function: ‘offset_xy()’ which came out of a discussion here in the forums. It calculates the relative offset of the vertices to ‘center’ them.
RGTiled handles Physics polygon bodies here: https://github.com/roaminggamer/SSK2/blob/master/ssk2/tiledLoader.lua (527-539)
Notice that the physics record has an x and y (offset) that has to be added to the vertices. Also notice the object offset by half height/width values. This is because Tiled uses a corner anchor, while I’m placing the bodies by their center.
You will need to take a look at the record for the object you’re drawing and adjust accordingly.