Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Maranpis |
Hello
How can I use the same functions but depending on whether one variable or another uses them? For example:
onready var Dialogue_Loom =get_node("Npc/Dialogue_Loom")
onready var Dialogue_Guybrush =get_node("Player/Dialogue_Guybrush")
I want to use these two functions:
func _process(_delta):
if dialogue.get_visible_characters()> dialogue.get_total_character_count():
dialogue.set_visible_characters(-1)
Timer.stop()
yield(get_tree().create_timer(2),"timeout")
dialogue.set_visible_characters(0)
text_line_finished()
func Timer_Timeout():
dialogue.set_visible_characters(dialogue.get_visible_characters()+1)
Any idea of how can I re-use these pieces of codes without having to write it twice for each variable?
Thanks