How do I warp my player character back to where he started in a level?


I still have this problem

remove no.7 line

1 Like

ok thx.
Now how do I spawn/unspawn him.

at the moment it seems he’s just there, and my code for spawning him doesn’t do anything, but I could be wrong. I don’t think I’ve got to that part yet

yes because at the main_script.gd’s ready, it spawns him directly when the node is ready

1 Like

I removed the ready code and he’s still just there

if you want to call respawn(which is unspawn then spawn), add the same

var new_player=player_scene.instantiate()
game2d_node.add_child(new_player)
current_player=new_player

on the func respawn():

did you removed the player scene from level scene?

I removed the player scene from the level, but the player is the game node

then dont put the player scene on game2d node, just let the mainscript code spawn it from code

I removed it, but it doesn’t spawn in

you removed the ready function with spawn code in it, of course it doesnt spawn

1 Like

I added it back in but it still doesn’t spawn

how does the script know that the rigidbody is the player that it’s calling to spawn?

check the remote tab during runtime, if it still there but just outside view or not

because it’s saved as a PackedScene, and being referenced to be called from @export var player_scene: PackedScene with .instantiate()

so what should I do?

did it spawn when the game run?, once again check the remote tab

It doesn’t look like he spawned.

screenshot what’s inside your coffeecup scene

1 Like

coffecupscene