shoDater/scenes/house/assets/scripts/dialog.gd

102 lines
2.5 KiB
GDScript

extends RichTextLabel
var shoBedroom = preload("res://scenes/house/assets/img/bg_shobedroom.jpg")
var dnum = 0
var currentlyDisplaying = ""
var displaying = false
var freeze = false
signal shounicTrigger
signal shounicExit
signal shoPhoneTrigger
signal shoPhoneExit
signal shoKnifeTrigger
signal shoKnifeExit
signal fadeToBlack
signal unfade
func _ready():
dnum = 0
displaySlow("Outside shounic's house")
var save = FileAccess.open("user://chapter.sds", FileAccess.WRITE)
save.store_line("chShoHouse = 1")
unfade.emit()
func displaySlow(txt):
currentlyDisplaying = txt
displaying = true
var doneChars = ""
for character in txt:
if displaying:
doneChars = doneChars + character
await get_tree().create_timer(0.015).timeout
if displaying:
text = doneChars
if not get_child(0).playing:
get_child(0).play()
else:
break
else:
break
currentlyDisplaying = ""
displaying = false
func _on_continue_pressed():
if not currentlyDisplaying and not freeze:
match dnum:
0:
displaySlow("...I must find a way to break into the house of that cat I saw earlier")
1:
displaySlow("They are too beautiful for me to not attempt to commit a serious federal crime")
2:
displaySlow("I've stolen a crowbar from the HL2 exhibit and I'm ready to break in")
3:
displaySlow("Do I really want to though?")
4:
displaySlow("Yes. Yes I do.")
fadeToBlack.emit()
5:
displaySlow("*glass breaking noises*")
6:
displaySlow("I'm in")
get_node("/root/Control/Background").set_texture(shoBedroom)
unfade.emit()
7:
shounicTrigger.emit()
get_parent().get_child(1).text = "Shounic"
get_parent().get_child(1).visible = true
displaySlow("What the hell are you doing here??")
8:
displaySlow("Aren't you that random homeless person from the trivia quiz yesterday?")
9:
displaySlow("I'm calling the police.")
shoPhoneTrigger.emit()
10:
displaySlow("...")
11:
displaySlow("...")
12:
displaySlow("...")
13:
displaySlow("They are coming in 5 minutes.")
shoPhoneExit.emit()
14:
displaySlow("You have exactly that amount of time to leave.")
15:
displaySlow("...")
16:
displaySlow("...")
17:
displaySlow("...")
18:
displaySlow("Still not leaving?")
19:
displaySlow("Then I will have to evict you...")
20:
displaySlow("By force.")
shoKnifeTrigger.emit()
dnum += 1
elif not freeze:
displaying = false
text = currentlyDisplaying
currentlyDisplaying = ""