school-game/godot/Dialogs/Josephine1.gd

46 lines
1.1 KiB
GDScript

extends Node
var dialogue_state : int
@onready var dialoguePopup = $"../../DialoguePopup"
@onready var buttona = $"../../DialoguePopup/DialogBox/ButtonA"
@onready var buttonb = $"../../DialoguePopup/DialogBox/ButtonB"
# Called when the node enters the scene tree for the first time.
func _ready():
dialogue_state = 0
func talk(answer = ""):
dialoguePopup.npc = self
dialoguePopup.npc_name = "Josephine"
match dialogue_state:
0:
dialogue_state = 1
dialoguePopup.dialogue = "Hello you! This is a test!"
dialoguePopup.answera = "Understood."
dialoguePopup.answerb = "Tell me more."
dialoguePopup.open()
1:
match answer:
"A":
dialogue_state = 3
dialoguePopup.dialogue = "Well. There's a lot to cover. Bye!"
dialoguePopup.answera = "End"
buttonb.visible = false
dialoguePopup.open()
"B":
dialogue_state = 3
dialoguePopup.dialogue = "I'd rather not..."
dialoguePopup.answera = "End"
buttonb.visible = false
dialoguePopup.open()
2:
dialogue_state = 3
dialoguePopup.answera = "End"
buttonb.visible = false
# dialoguePopup.open()
3:
dialogue_state = 0
dialoguePopup.close()