class_name GameControlClass
extends Control
@onready var user_input = $UserInput
@onready var output_window = $OutputPanel/Output
var is_tween_called: bool = false
var text_grab: String = ""
var color_tween: Tween
var text_tween: Tween
var particle_tween: Tween
const introduction_const = preload("res://Assets/Scripts/StoryResourceScript.gd")
var is_working_on: bool
func _ready():
# Configuration Portion
output_window.bbcode_enabled = true
output_window.scroll_following = true
# Local Variables
var introduction_script = introduction_const.new()
# Logic
user_input.editable = false
text_graduality(introduction_script.introduction_text)
func _on_game_tick_timeout():
await_call()
func await_call():
if color_tween:
color_tween.kill()
if text_tween:
text_tween.kill()
if is_tween_called == true:
if text_grab == "":
pass
else:
user_input.editable = false
text_graduality(text_grab)
is_tween_called = false
if is_working_on == true:
user_input.editable = false
else:
pass
func text_graduality(new_text):
is_working_on == true
var text = new_text.split()
var point: int = text.size()
var end_point: int = 0
while point > end_point:
for word in text:
for char in word:
output_window.append_text(char)
await wait_for_seconds(0.01)
point -= 1
print("chars left: "+ str(point))
output_window.newline()
user_input.editable = true
is_working_on == false
#
# Debug Stuff
#
print("end_size is: " + str(end_point))
func text_popout_effect(new_text):
pass #next thing to do
func wait_for_seconds(duration):
var timer = Timer.new()
timer.wait_time = duration
timer.one_shot = true
add_child(timer)
timer.start()
await timer.timeout
timer.queue_free()
func _on_user_input_text_submitted(new_text):
is_tween_called = true
text_grab = new_text
user_input.clear()
If I can provide any insight into anything please let me know. This is for a text based adventure game.