extends Area2D


@onready var Dialogue : Control = $Dialogue

@onready var InteractibleManager = $InteractibleManager

var Player : Node2D

@export var Cost : int = 100

var items = ["Shoes"]

@onready var item = items.pick_random()

# Called when the node enters the scene tree for the first time.
func _ready() -> void:
	Player = get_tree().get_first_node_in_group("player")
	
	match item:
		"Shoes":
			Cost = 200
			
	Dialogue.DialogueLabel.text += " - $" + str(Cost)


# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
	if Input.is_action_just_pressed("interact") and InteractibleManager.selected and Player.Money >= Cost:
		Player.Money -= Cost
		
		if item == "Shoes":
			Player.Speed += 300
			Player.GUI.add_item("Shoes")
		queue_free()
