Part 18: Add some music and add some spice!

Now for some music! Feel it! No pictures here and in the free version no pictures allowed.

Before the while loop, add

#Play music infintely till the game runs
MUSICFILE = "background_music.mp3"


The code loads the music file and runs it again and again in a loop, till we stop it.
In the game over part of the code.

    GAMEOVERMUSIC = "gameover.mp3"
    PLAYONCE = 0
    if(len(wall_group.sprites()) == 0):
        print("game over")


The code stops the background music, loads the game over music and plays it only once this time (PLAYONCE = 0).

Now, what if we need to add levels to our game, by making the wall structure more difficult to break?
Ready for the last challenge?


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s