mte.getTilesWithProperty(<anything>) always nil - what am i missing here?

Hi

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?

Thanks

here’s my code: 

local tiles_with_lights = G.mte.getTilesWithProperty(“physics”)

(G is just a global variable - that is not the issue. There are no error messages. I am printing out tiles_with_lights and it says nil

Heres a screenshot showing a tile with that property: http://screencast.com/t/RhfHFmRtGKsH

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 &nbsp;&nbsp; &nbsp;local tile = value &nbsp;&nbsp; &nbsp;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

“for key,value in pairs(tiles) do”

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.

here’s my code: 

local tiles_with_lights = G.mte.getTilesWithProperty(“physics”)

(G is just a global variable - that is not the issue. There are no error messages. I am printing out tiles_with_lights and it says nil

Heres a screenshot showing a tile with that property: http://screencast.com/t/RhfHFmRtGKsH

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 &nbsp;&nbsp; &nbsp;local tile = value &nbsp;&nbsp; &nbsp;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

“for key,value in pairs(tiles) do”

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.