I need help with a Quiz game

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By pointlessperson1

I`m trying to create a quiz function in Godot but i do not know how to approach the problem what nodes should i be using and scripts

The way i would like the quiz to work is by typing into a text box the pressing enter than have the game tell you if you right or wrong

:bust_in_silhouette: Reply From: njamster

Take a look at the LineEdit-node. Connect a function to it’s text_entered-signal and use it’s argument new_text to evaluate if the answer was correct or not:

func on_LineEdit_text_entered(new_text : String) -> void:
    if new_text == "Yes":
        print("Correct!")
    else:
        print("Incorrect")

Note that the example above is case sensitive: answering “yes” or “YES” will be treated as incorrect. Consider converting the answer to lower-case to avoid that:

new_text = new_text.to_lower()

I assume in the above response, njamster meant that answering “yes” or “YES” will be treated as incorrect…

jgodfrey | 2020-04-29 14:03

Correct, fixed it. Thanks for the remark! :slight_smile:

njamster | 2020-04-29 14:15

Aye thanks mate

pointlessperson1 | 2020-04-30 00:46