Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Lynn_Len |
I’m trying to make a dating sim and I am currently working on dialogue boxes. When I click with the left mouse button after all of the text in a string has been written it will move to the next string to write; but I also want use the same mouse click to instantly write all of the string at once. Because I’m using the same mouse input to do two different things. I have tried to use a Boolean variable (called isDone) to differentiate the two mouse inputs but it’s complicated things because the moment the isDone variable become true I can’t turn it false again.
#DialogueBoxs.gd
extends RichTextLabel
var dialog = ["Hello and goodbye", "HELLO, GOODBYE!", "Now I say goodbye and you say hello"]
var page = 0
var isDone = false
func _ready():
set_bbcode(dialog[page])
set_visible_characters(0)
set_process_input(true)
func _input(event):
if event is InputEventMouseButton:
if (isDone):
if get_visible_characters() > get_total_character_count():
if page < dialog.size()-1:
page += 1
set_bbcode(dialog[page])
set_visible_characters(0)
isDone == false
if !(isDone):
if get_visible_characters() < get_total_character_count():
set_visible_characters(get_total_character_count())
print("False")
if get_visible_characters() == get_total_character_count():
isDone = true
func _on_Timer_timeout():
set_visible_characters(get_visible_characters() + 1)
Could someone tell me how to make this work.