0 votes

I have recently been making a thwomp-like enemy for my 2D platformer. It's looking great right now, but I've found a concerning edge case:

The player rides the thwomp up to the ceiling, and then gets pushed into the ceiling's collider! They're stuck there for the rest of time.

In general, if a player (a kinematic body) is squished between two walls, they should die. Is there a generalized way to know when something like this is happening and call the appropriate function?

asked Jun 4 in Engine by Kanor (94 points)

1 Answer

0 votes

As I don't know your code and/or scene tree, this answer will be rather vague but: Attach a RayCast2D/ Area2D at the bottom and another RayCast2D/Ara2D at the top of of the player. When both collide with a wall and the player is pushed, call die().

answered Jun 6 by njamster (9,824 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.