Boolean properties in Tiled

Hi,

When i assign a property in Tiled, as a boolean it is recognised in MTE as a string.

Ex:

in Tiled i set a property

isEnemy = true

when i check that property in tiled it is object.properties.isEnemy == “true” instead of boolean true

I have manually worked around it, but it aint pretty.

Am i doing anything wrong here ?

Cheers,

Tommy

Hello thassman,

Tiled stores every property as a string, including numbers and what we would recognize as boolean values like true and false. As far as I’m aware there’s no way to change this. The best you can do is use the shortest string possible for your commonly-used values. Comparing two long strings like “true” and “false” takes longer than comparing two short strings like “0” and “1”. 

Hello thassman,

Tiled stores every property as a string, including numbers and what we would recognize as boolean values like true and false. As far as I’m aware there’s no way to change this. The best you can do is use the shortest string possible for your commonly-used values. Comparing two long strings like “true” and “false” takes longer than comparing two short strings like “0” and “1”.