String comparison only works with the first click

I’m building a simple match type system where you’d make a choice between three objects and if you guessed right, you win. Guess wrong and you lose. I’ve got a text object that’d tell me if it’s a win or lose. The problem I’m having with it rn is that correctly writes win or lose on the first object click. If I clicked again, the text object telling me if it’s win or lose wouldn’t change at all. It would just stay as is until I re-run the game

You haven’t included all the events. Where are you setting the value of Choice_shape? Are you resetting the random piece to match?

Also, your first line runs the possibility of the none of the choices having the random choice to match. For example, the random piece could be 2, while the choices have 0, 0 & 1. You’de be better off fixing the animation number for each choice in the editor.

Additionally, you already have the shape name, why do you set it 2 more times? Your match system can be reduced to 2 events :

1 Like


I forgot I had to delete the other images for it to fit in post

I see a lot of redundant events in those screen snips. Here’s my take on what you’re trying to achieve (I added the escape key to change the random object to guess). Click on a matching choice, and “Win” is displayed. Click on a mismatch, and “Lose” is displayer :

I added an object group in the editor, with members Choice_1, Choice_2 and Choice_3.

Darn. I should spend a bit more time looking through the expression builder. I hadn’t realized functions like those existed. Thanks for the help, man!

1 Like