Giter Club home page Giter Club logo

Comments (4)

fallahn avatar fallahn commented on July 26, 2024 1

From the Tiled format document:

id: Unique ID of the object. Each object that is placed on a map gets a unique id. Even if an object was deleted, no object gets the same ID. Can not be changed in Tiled. (since Tiled 0.11)

This is the UID returned by Object::getUID()

gid: A reference to a tile. (optional)

This is the GID/global tile ID of the object returned by Object::getTileID()

Tile global tile IDs in Tiled start at 1. 0 represents an empty tile in the map. Each tileset starts at 0, and then the tile IDs in that tileset are added to TileSet::getFirstGID() to return the global ID of the tile in the map. I hope that makes sense. You can read more in the tileset documentation here.

I haven't considered adding support for objecttypes.xml as I've always thought of it as more of an editor config, but I don't see why it couldn't be loaded if it is found in the same path as the current map. It should be trivial to use something like std::unordered_map to map the type strings to the loaded properties. Pull requests are always considered! 😉

from tmxlite.

Eren121 avatar Eren121 commented on July 26, 2024

And also tile property ?

from tmxlite.

fallahn avatar fallahn commented on July 26, 2024

Not sure what you mean by type rules. An object will contain its type string as stored in the map file, available via Object::getType(). The map loader doesn't read the objecttypes.xml file as that's not part of the map, so you'll have to load that yourself.

The tile property of the object is available via Object::getTileID() and optionally Object::getFlipFlags()

from tmxlite.

Eren121 avatar Eren121 commented on July 26, 2024

I mean that I think that many classes have properties: objects, tilesets, and individual tiles inside tileset.
Was I needed was individual tile properties. But it's ok, I found it under Tileset::Tile::getProperties().

But I thought objects don't have tile IDs, So what is Object::getTileID()?

For object types, yes I mean the default properties, like a class default stored in objecttypes.xml.
Is it planned anytime soon by chance (or will a pull request be considered) ?

I have also another question regarding IDs. I'm uncertain how GID works.
Does every ID returned by tmxlite starts at 1? I know there is like a +1 offset convention in file but only in certain places (in .tsx files, GIDs look like to start at 0, but Tilset::getTiles()[0].ID == 1). I mean there is in the tileset.tsx:

<tile id="0"></tile>

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.