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:
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!
function Player:filter(other)
if other.type == "OneWay" then
if self.y + self.height <= other.y then
return "slide"
end
else
return "slide"
end
end
For anyone who stumbles upon this, I just gave the player a filter function that does the one way checking. I then gave my platform object a variable called 'type', which is a string representing whatever name you want for your object. You would then pass the filter function as an argument into the player's world:move(). Understanding filters is very useful when it comes to utilizing bump effectively. Here is a link to the documentation, which of course, helps tremendously! https://github.com/kikito/bump.lua. Thanks anyway!