Skip to content

using TmxEntity.loadGraphic doesn't really work #21

@Senevri

Description

@Senevri

( Duplicate of #5 )

Basically, it only works if the tile layer is using the first tileset created, and thus it's Gids start at 1. otherwise, it tries to, for an example, look for Gid 35 on a 8x4 tilemap.

Hack:

var firstgid = 1;
//let's get that first gid!
for (ts in map.tilesets) {
    if (ts.imageSource.substr( -Std.string(tileset).length) == Std.string(tileset)) {
        firstgid = ts.firstGID;
    }
}

...

gid = layer.tileGIDs[row][col] - firstgid; 

Even this doesn't work when using funky things such as several tilesets using the same image - sometimes you might want to get a subsection of a tile, after all....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions