Best way to go about it ?

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

I am thinking to make a trivia game where I display an Image having many different things like a tree, lake, birds, rock, etc. I want to place dots on these things. This I can do.
Then I want to display a prompt asking “Where is the lake ?” and want the user to select the dot placed on the lake. Wrong selections should say “Wrong” and the correct ones should give points. I achieved this using a simple array containing the names of the things and lousy logic which I know is not the best approach.
I wanted to know if there’s a good tutorial somewhere similar to this or perhaps if you could tell me how to go about it in the best way possible. Thank you !

A Dictionary would provide a fairly clean implementation here. So, map the necessary things together in a single record, which could include item names, item descriptions, (anything else), and a reference to the “dot” object that needs to be clicked for that item.

Then, when the user clicks something, it’d be very easy to determine if they clicked the right thing. Just compare the clicked item to the stored “correct” item reference.

jgodfrey | 2023-04-18 16:54

Jgodfrey’s suggestion sounds good.

godot_dev_ | 2023-04-18 17:44

Thank you! Dictionaries helped!

Scavex | 2023-04-21 17:22