vnen / godot-tiled-importer

Plugin for Godot Engine to import Tiled Map Editor tilemaps and tilesets
MIT License
838 stars 87 forks source link

Tiled custom property name converted to Tilset name #92

Open dfleury2 opened 6 years ago

dfleury2 commented 6 years ago

Hi, I was reading the packpub book to create game with Godot (by C. Bradfield), and the chapter 2 uses native Tileset and TileMaP I decide to use Tiled for the fun and your importer.

Got an issue about converting name. from how it's done in the book and how Tiled work.

Do you think something like this in the importer can help ? and what do you think about this practice ?

Adding these lines to tiled_map_reader.gd (line 699), after the result.create_tile(gid)

        if rel_id in ts.tileproperties:
            if 'name' in ts.tiles[rel_id].properties:
                var tileset_name = str(ts.tiles[rel_id].properties['name'])
                print('Identified Tileset id ' + str(gid) + ' as ' + tileset_name)
                result.tile_set_name(gid, tileset_name)

Sorry for not using pull request, got no clone yet.

vnen commented 6 years ago

I guess it's fine, since Godot provides names for tiles. While Tiled does not have tile names, a custom property could be used indeed.