This is a Simon game app I created with Bolt while on a long plane flight. It is the most complex thing I’ve done in the block programming - beyond this I think Java Script will be easier. But it does show some fun things you can do in Scratch if you are patient. This models the classic Simon color game of memory where 4 colors and sounds are played repeatedly in growing sequence lengths and the user needs to remember and play the colors back in order - each successful play adds another color to the sequence. In the classic game the users pushed a button on the device - in this BOLT version the user tilts the ball from level to one of four angles. Best played from the ball level - the user tilts diagonally to the four corners of the matrix.
The app has 4 functions:
- Core game loop - the main part of the program - located up top
- Set game function - this creates the game variables and randomly assigns colors. Since there are no arrays in Scratch I had to create 20 variables - the max sequence length
- The “Play Color” function - plays the colors in the game in order as defined by “set game”. The functions works as follows: on turn 1 - variable one from “set game” - turn 2 - variable one and variable two from “set game” - turn 3, variable 1, 2 and 3 etc… This function also calls another function “Play Matrix” which displays the color and plays a sound for the corresponding colors
- The “Check Color” verifies the user tilted the ball in the right direction for the color sequence. If they get it wrong it sends a fail message to the main game loop - if successful the game continues
Sometime the user thinks they tilted in the right condition and it fails - this can occur for two reasons.First they didn’t go back to level between colors (tilt, level, tilt level, etc…) even if it is the same color they should pay in this manner. The second is poor bluetooth - the computer may not catch a command coming back and record it as a fail. I think I could add logic to wait for a response or clear the value after reading it - perhaps someone can make it more robust!
Please share your experience and thoughts on this program - I had a lot of fun making it. You can also rewrite this to work on SPRK+ or even mini - I’d love to see that port as well.