I’m using the function mte.getTilesWithProperty with just one variable (the name of the property) and no matter what property name i put it, it is always nil. My mini map has tiles with a property “physics” at least - but it’s still returning nil. I feel like I’m not seeing something here. What am I missing?
I went to a tile in Tiled and set first parameter to physics and other parameter to true. I painted some of that tile on my map.
Next in the code I did:
local tiles = mte.getTilesWithProperty("physics") for key,value in pairs(tiles) do local tile = value tile:setFillColor(1, 0, 0) end
All those tiles are now red, it appears to be working fine for me.
EDIT:
Oh if I only do:
local tiles = mte.getTilesWithProperty("physics") tiles:setFillColor(1, 0, 0)
I get that nil value error that you are getting also, it appears you need to use the looping of
Btw, although you may have already figured this out, I think mte.getTilesWithProperty() only returns tiles that are on screen… aka a current display object.
I went to a tile in Tiled and set first parameter to physics and other parameter to true. I painted some of that tile on my map.
Next in the code I did:
local tiles = mte.getTilesWithProperty("physics") for key,value in pairs(tiles) do local tile = value tile:setFillColor(1, 0, 0) end
All those tiles are now red, it appears to be working fine for me.
EDIT:
Oh if I only do:
local tiles = mte.getTilesWithProperty("physics") tiles:setFillColor(1, 0, 0)
I get that nil value error that you are getting also, it appears you need to use the looping of
Btw, although you may have already figured this out, I think mte.getTilesWithProperty() only returns tiles that are on screen… aka a current display object.