mapeditor / tiled

Flexible level editor
https://www.mapeditor.org/
Other
10.82k stars 1.72k forks source link

Tile Animations: allow animations to have a name #1059

Open LearnCocos2D opened 8 years ago

LearnCocos2D commented 8 years ago

Right now, the tile animations can only be accessed by number (GID). For an end-user API it would be much nicer to be able to have a method "playAnimationNamed:atCoord:" because usually the user doesn't have or doesn't want to have to use a GID number that might even change while editing the map/tileset.

No need to check for duplicate names, and name needn't be required, optional attribute suffices.

bjorn commented 8 years ago

Would this be a duplicate of #986?

LearnCocos2D commented 8 years ago

Somewhat. I would only need animation names, not multiple animations per tile.

bjorn commented 8 years ago

Ok, but once you name the animations, you can also have multiple of them. If you'd just allow naming and not multiple animations, then I'd rather add names to the tiles. Yet, this can already be done using a custom property.

Note that of course using GIDs is out of the question, and I usually prefer Tiled support libraries to not expose them to the user at all (the Qt based libtiled doesn't either). For identifying tiles without hardcoding tilesets and tile indexes, the preferred mechanism is to use custom tile properties.