Simon Says in Chipmunk Basic
Now at https://github.com/anoved/Chipmunk-Basic-Stuff/tree/master/Simon%20Says
This is a simple version of Simon Says written in Chipmunk Basic. The game is played by attempting to repeat the pattern played by the computer. Each time you successfully mimic the computer’s play the pattern is lengthened.
The game is playable but is primarily intended as an example. There are some rough edges: the game may become confused if you hold down keys too long or type too rapidly.
Download
You need Chipmunk Basic to run this program.
- cbsimon.bas (7k .bas)
Layouts
The layout and some of the behavior of the game “board” is read from data
statements at the end of the program. The layout defines the number of game panels, their size and position, their colors, the notes heard when they are played, and the keys associated with them. The default layout is shown in the screenshot above, but others are included:
To use these or other layouts comment out the default data
statements and uncomment or insert the desired layout data
.
Layout Data
The data
listed in cbsimon.bas
is condensed. When editing or creating your own data
, you’ll probably want to make better use of white space and separate data
statements to group related items, like this. It’s also helpful to give each panel a different color (unlike the included alternates).
Here is the meaning of each layout data
item:
- width of window
- height of window
- window background color % red
- window background color % green
- window background color % blue
- duration of computer panel flash (seconds)
- duration of pause between computer panel flashes (seconds)
- duration of pause between turns (seconds)
- duration of player panel flash (seconds)
- MIDI “voice” for sounds (instrument ID; piano is
1
) - thickness of game over highlights
- wrong panel highlight % red
- wrong panel highlight % green
- wrong panel highlight % blue
- right panel highlight % red
- right panel highlight % green
- right panel highlight % blue
- number of panels
The following series of data
items is then repeated for each game panel:
- panel upper left X coordinate
- panel upper left Y coordinate
- panel bottom right X coordinate
- panel bottom right Y coordinate
- inactive panel color % red
- inactive panel color % green
- inactive panel color % blue
- active panel color % red
- active panel color % green
- active panel color % blue
- MIDI “key” (musical notes to MIDI keys, frequencies to MIDI keys)
- keyboard key