17 lines
513 B
GDScript
17 lines
513 B
GDScript
extends StaticBody2D
|
|
|
|
@export var dialogue_lines: Array[String] = ["Hello!", "Good day to you!", "Welcome!"]
|
|
var can_interact: bool = false
|
|
|
|
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
|
|
$Greeting.play()
|
|
else:
|
|
$CanvasLayer.visible = false
|
|
get_tree().paused = false
|
|
$Goodbye.play()
|