Skip to content

Object Positions #15

@Zulu-Inuoe

Description

@Zulu-Inuoe

Creating this from #14

Tiled Objects (in an Object Layer) have 'surprising' behaviour with regards to the meaning of the X and Y coordinates:

  1. Rectangles and ellipses without width/height values use X/Y as their center
  2. Rectangles and ellipses with their width/height values set use X/Y as their top-left corner
  3. Polygon objects use X/Y to position the first point in the polygon. Rotations rotate about this point
  4. Tile Objects use X/Y as the bottom-left corner
  5. 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!

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions