pytmx icon indicating copy to clipboard operation
pytmx copied to clipboard

I'm having a confusing experience with a Tile layer

Open LinkBenjamin opened this issue 2 years ago • 0 comments

I created my map in Tiled, and I have multiple layers - a ground layer, an invisible layer for boundaries, and another Tile layer with the items that are in my world.

I've loaded the various layers into a dictionary:

layouts = {
    'boundary': tmx_data.get_layer_by_name('Barriers'),
    'objects': tmx_data.get_layer_by_name('Objects'),
    ...
}

I can iterate on the 'boundary' layout above - since it's not a visible layer and each space is either blank or filled with a barrier, it's working fine.

The problem arises when I try to display the objects in the world. I think I'm supposed to do this to get the images:

for x, y, image in layouts['objects'].tiles():
    if(image != None):
        Tile(x,y,[self.visible_sprites], 'objects', image)

None of my objects actually appear to == something besides None. I definitely have objects in the layer. Any ideas what I've missed?

LinkBenjamin avatar Aug 15 '23 13:08 LinkBenjamin