I'm trying to make some ladders for a 2D platformer. I would like the player to be able to walk/stand on the top of the ladder and pass through from below when climbing.
I was hoping to use an autotile for the ladder so that the bottom, middle and top of the ladder could be easily painted in the editor. But a few problems present themselves:
- I'm using two different layers: "platform" and "ladder", and I only want the very top of the ladder to have the "platform" layer (in one direction)
- There doesn't seem to be an option to choose one-way collision for a piece of an autotile.
My solution is to just use the "ladder" layer for the autotile (for detecting the ladder when the player is near it) and to manually place a CollisionShape2D
with the "platform" layer over the ladder-tops (to have the one-way collision for standing on top of it).
What I'm wondering: is there a means (in script) to check the bitmask of the autotile? I was thinking maybe I could automatically spawn the "ladder top" CollisionShape2D
wherever the bitmask meets the requirements of the top part of the autotile.
Of course, if anyone has a better method altogether, I'd love to hear that too. 😃