You may copy the following code, or download the zip file for the full game including the sounds I used.
I encourage everyone to experiment and improve the code. I hope to be doing the same and uploading my own upgrades to this code.
Thanks to Human Bolt Diary for the more efficient code. Now it's even simpler than I originally thought.
Code: Select all
# Music notes define notes = [ "images/a4.mp3", "images/a-4.mp3", "images/b4.mp3", "images/c4.mp3", "images/c-4.mp3", "images/d4.mp3", "images/d-4.mp3", "images/e4.mp3", "images/f4.mp3", "images/f-4.mp3", "images/g4.mp3", "images/g-4.mp3", ] # The game starts here. label start: $ count = 12 # How many notes will play before ending the program. label rando_music: python: for x in range(count): pick = renpy.random.choice(notes) renpy.play(pick, channel='sound') renpy.pause(0.5) return