extends Area2D

@onready var timer: Timer = $Timer
@onready var hurt_audio_player: AudioStreamPlayer2D = $HurtAudioPlayer

func _on_body_entered(body: Node2D) -> void:
	# Slow down everything
	Engine.time_scale = 0.5
	# Remove the player's collider, making them fall through the map
	body.get_node("CollisionShape2D").queue_free()
	hurt_audio_player.play()
	timer.start()

func _on_timer_timeout() -> void:
	Engine.time_scale = 1
	get_tree().reload_current_scene()
