Text Re-Configuration

I have a problem with getting my text to re-configure itself based on what it is clicked/corrected. For context, in the game I am creating, I want the player to click on a word, correct it, and then the text changes to fit their choice. For instance, there’s the sentence “I want pizza.” Since “want” is italicized, the player clicks it and two choices pop up to change the sentence to “I would like pizza”, or to keep it as “I want pizza”. If they choose “would like” the sentence changes to “I would like pizza”. If they choose “want” the sentence stays the same. I don’t have any coding for this since I don’t know exactly how it would work or how to go about creating this, nor do I have any visuals to go along with it :c. Whoever can help, thank you so much though!

One way to go about this is to make the text that you want to be able to click an independent text object.

So “I ____ pizza” would be a text object and “want” would be an other text object that you put in place.

So than you can easily check if the word “want” was clicked by comparing the position of the mouse and the text object at the moment the mouse was clicked.

Then, you can have 2 text objects with the other 2 options hidden somewhere that you display the moment “want” was clicked.

Then, based on which option was clicked, you can change the text of the text object to replace “want” with the selected and you probably also need to change the text “I ____ pizza” to fit the new option as “would like” is longer than “want”.

I can think of much more advanced dynamic and flexible solutions but it would take too long to explain. In case the above method does not fit your project, try to explain in more detail why and then maybe we can help you find a better solution.

2 Likes