How can I make one way spikes in godot

Godot Version

4.7

Question

Im trying to make one way spikes in godot, but it won’t work. I tried setting the collisionShape2D to oneway but that doesn’t work. I have a basic kill_zone script. Using tileset for the spike sprite

extends Area2D




func _on_body_entered(body: Node2D) -> void:
	$Timer.start()
	Engine.time_scale = 0.5
	body.get_node("CollisionShape2D").queue_free()

func _on_timer_timeout() -> void:
	Engine. time_scale = 1.0
	get_tree().call_deferred("reload_current_scene")
	queue_free()

Have you tried _on_area_entered instead? Do you have another collisionshape/area2d entering with the correct Collision Layer and Mask?

That setting doesn’t have any effect if collision shape is child of Area2D.

When body enters, check the global position of the entered body and the area that the body enters. You’d know which one is on top or bottom or left or right. And you can do your function accordingly