Game 1 is a type of getting game where you must keep in beat of the music; While playing between each beat of music, we'll point left and right to signify the A and B buttons; then when there is a break in the music, the player must then press the button that wasÂ
supposed
 to be played.
We start with some melodies, stored in a list of lists:
1 tunes = [ ["C4:4", 'C', 'D', 'D', 'E', 'E', 'x', 'G', 'G', 'E', 'E', 'A', 'A', 'x'], ["C4:4", "D", "E", "C", "C", "D", "E", 'x', "C", "E", "F", "G:8", "E:4", "F", 'x', "G:8"], ["C2:2"] + [letter for letter in "ABCDExFGFEDCBABxCDEFxGFEDCxBA"]]
2
Connect the speaker between pin 0 and ground using some aligator clips.
1 def game1(): # Guess the tone lives = 3 for level, tune in enumerate(tunes): for pos, tone in enumerate(tune): if pos % 2 == 0: display.show(Image.ARROW_W) else: display.show(Image.ARROW_E) if tone != 'x': music.play([tone]) else: correctGuess = game1Guess(level, pos) if correctGuess: music.play(music.POWER_UP) display.show(Image.HAPPY) else: lives -= 1 music.play(music.POWER_DOWN) display.show(Image.SAD) sleep(1000) if lives == 0: gameOver = True return # success! onwards to game 2 game2()