extends Node2D

var gems: int = 4

func _ready() -> void:
	#$YSort/Player.position = get_viewport_rect().size / 2
	$YSort/Player.load_hud($HUD)
	return


func _on_TreasureChest_gem_collected() -> void:
	gems -= 1

	if gems == 0:
		$YSort/Items/Door/doorClosed.visible = false
		$YSort/Items/Door/doorOpened.visible = true
		$DoorCollision.layers = 5



func _on_NextArea_area_entered(area: Area2D) -> void:
	if area.get_parent().name == 'Player':
		$YSort/Player.position.x = 195
		$YSort/Player.position.y = -335
