I want To see if my player is on top or beside the enemy in Godot. I want to kill the player if he goes beside the spider and kill the spider if the player jumps on it. my player and enemy are both KinematicBody2D's. I know how to kill the player or enemy(queue_free()
) except I cannot detect if the player is on top or below the player. How would I go about doing this?
Asked
Active
Viewed 164 times
0

Justiniscoding
- 441
- 5
- 19
-
Have you tried using a `Area2D` to detect when the player is beside the enemy? For jumping on the enemy, you could use a `RayCast2D` pointing down from the player. – hola Feb 10 '21 at 20:30
1 Answers
1
On CollisionShape2D
you can enable one_way_collision
for both player and enemy choose collision way (top in your case), if it colides from the top just use queue_free()

Igor
- 28
- 4