Added progress & major dialog bugfix

This commit is contained in:
2020-05-16 13:22:42 -04:00
parent afde971c17
commit 7528cba7d7
33 changed files with 237 additions and 8 deletions

View File

@ -5,6 +5,7 @@ signal finished_text
signal message_list_empty
func speak(message):
done = false
spoken_text = ""
for character in message:
soundQueue.append(character)
@ -24,6 +25,7 @@ var speaker = "default"
var soundQueue = []
var spoken_text = ""
var playing_speech = false
var done = true
export var voice_pitch : float = 1
func play_audio():
@ -61,7 +63,9 @@ func play_audio():
print("No sound for: " + str(speaker))
else:
playing_speech = false
emit_signal("finished_text")
if len(soundQueue) == 0:
emit_signal("finished_text")
done = true
func del_obj(obj):
obj.queue_free()

View File

@ -13,7 +13,7 @@ var did : int
var choices : int = 1
var selected_choice : int = -1
export var speaker_name = ""
var final_display_message = ""
func _ready():
story_reader.read(story_file)
@ -30,16 +30,22 @@ func _on_text_update():
func start_dialog(record : String):
start_dialog_did(story_reader.get_did_via_record_name(record))
func intialize_dialog():
if not gui:
gui = get_node("/root/World/GUI")
func start_dialog_did(dialog_id : int):
gui = get_node("/root/World/GUI")
intialize_dialog()
if not gui.is_in_dialog():
nid = 1
did = dialog_id
process_message(story_reader.get_text(did, nid))
func has_next_node():
return story_reader.has_slot(did, nid, 0)
func process_message(message):
gui.clear_choices()
@ -62,6 +68,7 @@ func process_message(message):
i = i + 1
speak(message)
final_display_message = message
func _on_choice(decision):
move_dialog_forward(decision)
@ -75,5 +82,6 @@ func move_dialog_forward(decision = 0):
gui.finish_dialog()
func _process(delta):
if(Input.is_action_just_pressed("ui_accept") and choices == 0 and playing_speech == false):
if(Input.is_action_just_pressed("ui_accept") and choices == 0 and final_display_message == gui.current_dialog()):
print("YEET")
move_dialog_forward(0)

View File

@ -3,7 +3,7 @@ extends "res://Scripts/Component/Interactable.gd"
func _ready():
connect("interacted", self, "_on_interact")
$Speaker.speaker_name = "Dr.Thadd"
$Speaker.start_dialog("intro_science")
#$Speaker.start_dialog("intro_science")
func _on_interact():
$Speaker.start_dialog("intro_science_followup")

View File

@ -0,0 +1,12 @@
extends Control
const SCROLL_SPEED = 25
func _ready():
$"/root/MusicManager".play_music("Dystopian/The Story Continues")
func _process(delta):
$Scolling.rect_position.y = $Scolling.rect_position.y - delta * SCROLL_SPEED
if abs($Scolling.rect_position.y) > $Scolling.rect_size.y + 100:
get_tree().change_scene("res://Scenes/Title.scn")

View File

@ -5,6 +5,7 @@ var looping : bool = false
func _ready():
main_player = self
bus = "Music"
func play_music(song, loop=true):
var audio_file = "res://Assets/Music/" + song + ".ogg"

View File

@ -1,10 +1,13 @@
extends CanvasLayer
func is_in_dialog():
return in_dialog
return in_dialog or $Dialog.is_visible_in_tree()
var in_dialog = false
func current_dialog():
return $Dialog/Textbox/Body.text
func set_dialog(message, speaker=""):
$Dialog.show()
in_dialog = true