Resetting position of a CollisionShape2D when it collides with another CollisionShape2D

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By unpwn

So, I have 2 player objects that are both CollisionShape2Ds. When one player jumps on the head of another player, I’d like to reset the position of the player who got stomped but not the position of the player that did the stomp. However when I change the position of one of the player objects, I believe it applies the position change to the other object as well due to them being in a collision state. What is the best way to achieve this in godot?

:bust_in_silhouette: Reply From: LoneDespair

func _physics_process(delta):

if is_on_ceiling():
set_position(Wherever you want the spawnpoint to be)

if is_on_floor():
print(“Killing is free”)

I believe this will only work for KinematicBody2D/KinematicBody
tho I’d still recommend, checking what they collided with