Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

6. Game #5, Balls Out! > Time for action — loading the game sound effects

Time for action — loading the game sound effects

To load sounds, we will create a method in the game class called LoadSounds. There, we will load sounds for an explosion, a hit sound, and a select sound:

  1. Create a new method called LoadSounds.
    Method LoadSounds:Int ()
    
  2. Load the three sounds called select, explosion, and hit (remember, no file extension!).
    sndSelect = eng.LoadSound("select")
    sndExplo = eng.LoadSound("explosion")
    sndHit = eng.LoadSound("hit")
    
  3. Close the method.
    Return 0
    End
    

What just happened?

We have created a method to load sounds into the game. To load sounds, we used fantomengine's LoadSound method. You don't need to add the file extension to it, as fantomengine will load the one that is right for that platform. In the case of iOS, it is the MP4 file format.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial