Simon Says - Follow me!

2

Index

Stats

5,893 visits, 12,248 views

Tools

Translations

This tutorial hasn't been translated.

License

This tutorial is licensed under CC BY 4.0. Please refer to the license text if you wish to reuse, share or remix the content contained within this tutorial.

Published on 1 Jan, 2012. Last updated 19 Feb, 2019

Let us now check, how the user follows along:

All right

The easiest is to compare, if the user entered the same sequence as simon:

We compare how many notes simon has presented with how many buttons the user has clicked in this round and then we check if both "words", eg. strings we have build during gameplay, are the same. This is only done, when at least one character is within the strings.

We then play a nice sound, increase the score and prepare the next round by cleaning the user-values.

After a short wait of 2 seconds the next round is started by calling the function simonsLastWord again.

User failed

Since we want to know, when a user does a wron move, at the time he does and not at the end of his turn, we have to check substrings:

All strings are appended to the right, so we compare the leftsubstrings of simonSays and userSays up to the count of the userinput.

If this goes wrong, the according sound is played, the whole game is reset and the "Restart" button is set to visible.

This concludes this tutorial. If you need any more information, let me know.

  • 0 Comments

Want to leave a comment? Login or Register an account!