Checkpoint spawn player below map

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

I have no idea what could possibly be causing this, I have an Area2D with a collision shape and a sprite(which is part of a tilemap). I’ve connected the Area2D to the Sprite with the following code:

func _on_Area2D_body_entered(body):
if == "Player":
	body.spawn_point = position

The animation does play when the player comes in range, however it always spawns under the map.
I’ve also tried connecting the Area2D to itself and used the same code (dont know if that was smart), however the player just respawns in its “original” spawnpoint at the start of the map.

Any ideas?

:bust_in_silhouette: Reply From: CreekWorks

add a position 2D and instead of body.spawn_point = position do

body.spawn_point = $Position2D

place the Position2D where you want the player (or object) to spawn