How do i make one way collisions for my TileMapLayer?

Godot Version

v4.7.2.stable.arch_linux [ed1daf0bf]

Question

Hi :3, I’m want to add these “background hills” to my game that you can jump through andget on top of.

I’m doing it with another TileMapLayer.
I was wondering if theres a quick way to setup one way collisions on them.

doing it by hand seems wrong, cause if I change something on the background i then have to move every point of the collider around, any suggestions?

the script on the colliders is just this, it makes the player be able to go down with S key

extends StaticBody2D
@onready var collider: CollisionPolygon2D = get_child(0);

func _ready() -> void:
	if collider.one_way_collision == false:
		collider.one_way_collision = true;
func _input(event: InputEvent) -> void:
	if event.is_action_pressed("crouch"):
		collider.disabled = true;
	elif event.is_action_released("crouch"):
		collider.disabled = false;

When assigning physics layers for your tiles you can enable one-way collision on certain tiles.

Instead of disabling the collider per-object you can use collision layers/masks so the player only detects (masks) the one-way tiles if they aren’t pressing “crouch”

oohhh nice I didn’t know that was an option in there, thank you so much :smiley: