I am making a memory guessing game where squares flash in a sequence (I have this flashing sequence working).
I am struggling to figure out how to identify the sequence of squares clicked by a user and match it the sequence shown.
I am not sure if I need to include any behaviours. I have tried to look on here but can seem to find anything relatable.
Hope you guys can help! Thanks!
Develop games in your browser. Powerful, performant & highly capable.
You can add an instance variable "sequence" to your squares, and when they are flashing, set sequence to 1, 2, 3.. etc.
When user clicks the squares, make a variable clickCounter, increase it with every click on the squares. Compare clickCounter with square.sequence and if they don't match, it means that the user made a mistake.
Or you can do this with two string variables.
When squares flashing, set string1 to (string1 & square.UID & ",")
When player clicking the squares, set string2 to (string2 & square.UID & ",")
Then compare if left(string1, len(string2))=string2
if not, user has made a mistake.