O'Reilly logo

Developing Mobile Games with Moai SDK by Francisco Tufro

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Background music

Now let's play some background music by following the given steps:

  1. At the bottom of Game:initialize you should add the following method calls:
        AudioManager:initialize ()
  2. We initialize the audio using AudioManager:initialize (the method we created earlier in this chapter):
        AudioManager:play ( 'backgroundMusic' )
  3. And then we play the background music. Remember that we defined it in the audio_definitions table inside audio_manager.lua.

That should be it. Run the game and you should be listening to an amazing song by Milhouse Palacios.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required