24 lines
623 B
GDScript
24 lines
623 B
GDScript
extends Area2D
|
|
|
|
@export var text : String
|
|
|
|
@onready var Dialogue : Control = $Dialogue
|
|
|
|
@export var ItemSpawnPositions : Array[Node2D]
|
|
|
|
@export var ItemScenes : Array[PackedScene]
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
Dialogue.DialogueLabel.text = text
|
|
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
for i in range(0, ItemSpawnPositions.size()):
|
|
if ItemSpawnPositions[i].get_child_count() == 0:
|
|
var newItem = ItemScenes.pick_random().instantiate()
|
|
ItemSpawnPositions[i].add_child(newItem)
|
|
|