extends Node2D

@onready var SpawnPoint = $RespawnPoint
@onready var Player = $Player

# Called when the node enters the scene tree for the first time.
func _ready():
	pass # Replace with function body.

# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
	if Input.is_action_just_pressed("quit"):
		get_tree().quit()
	elif Input.is_action_just_pressed("reset"):
		get_tree().reload_current_scene()

func _on_deathzone_body_entered(body):
	resetPlayer()
	
func _on_trap_touched_player():
	resetPlayer()
	
func resetPlayer():
	Player.velocity = Vector2.ZERO
	Player.global_position = SpawnPoint.global_position
