Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- extends Node
- var index = -1
- func _ready():
- # make all questions answers invisible
- for question in Node.get_children():
- question.visible = false
- question.get_child(0).visible = false
- show_next_question()
- func show_next_question():
- if index + 1 < Node.get_child_count():
- # increase the index by one and make the question
- index += 1
- Node.get_child(index).visible = true
- else:
- print("no more questions")
- func _on_question_pressed():
- # Hide the current question and show its answer.
- var question = Node.get_child(index)
- question.self_modulate = Color(1.0, 1.0, 1.0, 0.0)
- question.get_child(0).visible = true
- # Create a 5-second timer to display the new question
- var tween = create_tween()
- tween.tween_interval(5)
- tween.tween_callback(question.set_visible.bind(false))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement