0 votes

Hi all. I am making a platformer game and I have made some tiles with OWC (one-way collision) -- by adding StaticBody2D node to that tile in tilemap scene, and a CollisionShape2D with OWC turned on as a child of StaticBody2D node.

My game has gravity flipping and I implemented it successfully on everything except one-way tiles which now need to detect OWC in the other direction!

I've been trying to access individual tile's nodes, or adding tile's nodes to a group before converting it to tileset, but no luck.

Is there a way to gain access to certain tile's nodes?

If not, what would be a good approach to making one-way tiles that can flip? I'm thinking of creating a duplicate of those tiles which have OWC in the other way, and then making a code that replaces all tiles which have OWC in normal direction with these duplicates.

--- Karlo

in Engine by (18 points)

1 Answer

0 votes

Use tile_set function in TileMap node to get current tile set. After you get tile set currentily used in your TileMap you can use find_tile_by_name, tile_get_shape_one_way, but one way collision is a mess in Godot, I don't think that you can change direction of one way collision by default (you can rotate shape but if you search issues on Github you will see that rotation is not working), you must write your on logic for that.

by (243 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.