- Edited
I've just picked up godot and am trying to make a game where if a player dies(by hitting a spike or any other hazard) it forms a dead body at that position and the player position is reset to its original position. This is the function that gets called when the player hits a spike DeadBody is a kinematicBody2d
func die():
var DeadBody = preload("res://scenes/DeadBody.tscn").instance()
get_parent().add_child(DeadBody)
var temp_pos = position
position = original_pos
get_parent().get_node("DeadBody").position = temp_pos
sometimes they spawn at the players location but most of the times they don't
what am i doing wrong?