Enough talk, action speaks louder than words. Let's add some background music to our game.
__init__method and add the following four lines of code there:
musicMgr = base.musicManager self.music = musicMgr.getSound( "../Sound/Loveshadow-Takin_Yo_Time_(The_Wingman_Mix).wav") self.music.setLoop(True) self.music.play()
WorldClass_01.pyand run it from the command prompt.
Now we've got music! That's all there was to it. We just loaded the sound file into the
getSound, set it to loop with
setLoop(True), and told it to play with the
The song we loaded is called ...