Giter Club home page Giter Club logo

Comments (2)

fallahn avatar fallahn commented on June 27, 2024 1

Hi! I had indeed noticed this pecularity some time ago when working on one of my own projects. The inconsistency sadly runs a bit deeper than this - objects in the tmx file which aren't a rectangle contain a child node describing their shape, which the Shape enum is designed to represent. On the other hand rectangular objects have no child nodes (in which case tmxlite just assumes the object is rectangular) but they may or may not have a tile gid attribute if they are a tile object. sigh. I've always tried to maintain a 1:1 match for the data structures as closely as possible without making any assumptions on the end user's behalf, and this is already slightly skewed by the fact that I've had to introduce a Rectangle shape type which doesn't technically exist, at least not as a tmx node. For this reason I'm not keen on introducing a new member to the enum and, as you point out, it may break existing user's projects when Rectangle type objects suddenly become exclusively non-tile objects. However as an object may potentially have a tile ID Object::getTileID() exists, which can be used to determine if an object is a tile type. By default this returns 0 so it can be used something like:

if(object.getTileID())
{
    //must be a tile object
}
else {}

Which I believe is the intended (albeit slightly confusing) use. Of course should the tiled devs add support for modifying object origins I'll endeavour to support any new properties which may be added.

from tmxlite.

PatrickHoward avatar PatrickHoward commented on June 27, 2024 1

Thats a good point, I didn't think about checking the tileID, I think that will work as a temporary fix when properties in regards to origin placement come into fruition.

from tmxlite.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.