I'm trying to write a teleport script, how can I simply teleport PLayer to a position of a certain node?
I have this in my PLayer script:
func teleport_to(target_pos):
position = target_pos
How do I invoke it in a keypress script? Right now there's a line using Groups, but it doesn't work
export (NodePath) var teleport_target = null
if Input.is_action_just_pressed("enter_door") and player_in_door == true:
get_tree().call_group("Player", "teleport_to", get_node(teleport_target).position)
When I press that button there's an error:
Invalid type in a function 'get_node' in base Area2D (Teleport1):
cannot convert Argument from Nil to NodePath
Please help!