16 lines
550 B
GDScript
16 lines
550 B
GDScript
extends StaticBody2D
|
|
|
|
@export var dialogue_lines: Array[String] = ["Hello!", "Good day to you!", "Welcome!"]
|
|
var can_interact: bool = false
|
|
|
|
# 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 can_interact:
|
|
$CanvasLayer/DialogLabel.text = dialogue_lines[randi_range(0, 2)]
|
|
if $CanvasLayer.visible == false:
|
|
$CanvasLayer.visible = true
|
|
get_tree().paused = true
|
|
else:
|
|
$CanvasLayer.visible = false
|
|
get_tree().paused = false
|