Polyline coordinates


(Shahjada Ahmed) #1

I have a query about polyline coordinates.
How can I obtain the polyline coordinates from Tiled map editor?
I know the coordinate information reside inside map.json file.
Is there a way it can be passed on to corona lua code?

I can see an offset in the simulator for the whole polyline and I would like to correct it using code.
Image link : https://goo.gl/P6PzNR


(Thorbjørn Lindeijer) #2

The coordinates of the points of each polygon are stored relative to the position of the polygon object. As long as you did not rotate the object, that means to get the absolute positions of the points on the polygon, you’d just need to add the x/y position of the object to the x/y position of each polygon point.

If you do sometimes rotate your objects, you’d need to apply this rotation as well to get absolute positions. Rotation happens around the position of the object.

If you applied an offset to your object layer, then you should take that into account as well.


(Shahjada Ahmed) #3

Thanks for the response.
My question was : programmatically how I can extract these points from Tiled map so that I can manipulate/adjust them. Do I need to extract them from map.json file?
Thanks.


(Shahjada Ahmed) #4

This thread can be resolved now. There was an issue with Berry Tiled loader regarding polylines appearance in corona simulator, which was resolved yesterday