Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vertical position of map object is "artificially" modified #16

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

tnajdek
Copy link

@tnajdek tnajdek commented Jul 1, 2013

Hey there again!

While working with tmxlib I've noticed my map objects are position incorrectly, especially offseting y value by object's height is producing undesired effects. I'm wondering if this is done intentionally or it's a bug?

I've attached a pull request which highlights 2 pieces of code that might affect object positioning, one is the logic that offsets item's y value by it's height, second is a piece of code in mapobject.py that I can't figure out what is doing.

@encukou
Copy link
Owner

encukou commented Jul 1, 2013

Hello,
Yes, the y has a slightly different meaning than in the TMX format. This is a controversial design decision, but I believe I have sufficient reason for deciding differently than TMX.
tmxlib's tile and object classes are designed to be as similar to each other as possible. For example, you can easily iterate over all "tile-like objects" and do common operations on them. For this reason, in tmxlib, if a tile and a tile object are at the same place, they should have identical coordinates & size. If that's not the case then it's a bug.
Tiled (the project that defines TMX) took a different approach; the reasoning is explained here: mapeditor/tiled#386

Needless to say, TMX load/save or to_dict/from_dict should give you Tiled-compatible data, and TMX/tmxlib round-trips should work fine.

This needs to be documented better so I'll keep this report open (but I'll probably only get to it after EuroPython and a vacation).

@tnajdek
Copy link
Author

tnajdek commented Jul 3, 2013

Ahh, interesting, thanks for in-depth explanation. I'll modify my implementation to work around this. Hope you're having fun @ EuroPython, cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants