How to access custom properties from Tiled
Posted: Sun Oct 16, 2022 3:40 pm
Hi everyone, I am new to the forums, and this is my first post.
So I'm using Bump and STI for this project. I have an object layer in Tiled named "One Way", that will represent jump-through platforms. It has the custom property "collidable", which allows the layer to be considered solid. What I'm trying to figure out is, how to access that property from my code, and change it to false. The idea is, I want to disable the collision as long as the player is below the platform, and have it be true when I'm above. The code below that I tried doesn't seem to disable the collision, and it still treats the platform as a full on solid that the player can't jump through:
So I'm using Bump and STI for this project. I have an object layer in Tiled named "One Way", that will represent jump-through platforms. It has the custom property "collidable", which allows the layer to be considered solid. What I'm trying to figure out is, how to access that property from my code, and change it to false. The idea is, I want to disable the collision as long as the player is below the platform, and have it be true when I'm above. The code below that I tried doesn't seem to disable the collision, and it still treats the platform as a full on solid that the player can't jump through:
Code: Select all
for i, v in ipairs(gameMap.layers["OneWay"].objects) do
if Player.y > v.y then
v.properties.collidable = false -- Trying to access the collidable property from tiled
else
v.properties.collidable = true -- Trying to access the collidable property from tiled
end
end
If any more code is needed, or if there's anything I should specify, let me know. Thanks in advance!