-
Notifications
You must be signed in to change notification settings - Fork 9
Description
Creating this from #14
Tiled Objects (in an Object Layer) have 'surprising' behaviour with regards to the meaning of the X and Y coordinates:
- Rectangles and ellipses without width/height values use X/Y as their center
- Rectangles and ellipses with their width/height values set use X/Y as their top-left corner
- Polygon objects use X/Y to position the first point in the polygon. Rotations rotate about this point
- Tile Objects use X/Y as the bottom-left corner
- Text Objects use X/Y as their top-left corner
These rules apply even for collision objects in the Tile Collision Editor.
We'd like to come up with a way for users of this library to not have to implement this logic over and over.
My proposed fix would be to keep this code as-is and consider it the 'low level interface'. Then provide a 'high level interface' that provides better-behaving position functions to make it easier for library users so they don't each have to encode these very specific rules in order to get a 1-to-1 with the Tiled editor.
More concretely, something like providing places for object-center
, object-left
, etc.
We can also toss other utility style functions into this 'high level interface' to overall ease making use of Tiled.
Thanks!