Setting z-index for a tilemap?

Answering myself after a little more digging...
Here is the solution: Timemap is above the player? - #5 by Mahekaru

So a code snippet of my new scene init()

local tileset = gfx.imagetable.new("assets/images/tilemap-table-20-20.png")
    self.tilemap = gfx.tilemap.new()
    self.tilemap:setImageTable(tileset)

...
self.tilemap:setTiles(myLevel, 16)
    gfx.sprite.addWallSprites(self.tilemap, { 1, 2, 3, 4, 5 })
    self.tileSprite = gfx.sprite.new()
    self.tileSprite:setTilemap(self.tilemap)
    self.tileSprite:setZIndex(0)
    self.tileSprite:setCenter(0, 0)
    self.tileSprite:moveTo(0, 0)
    self.tileSprite:add()

And just remove the tilemap:draw() call on the scene update method.

And now it works like a charm :smiley:

1 Like