-
Book Overview & Buying
-
Table Of Contents
Gideros Mobile Game Development
By :
Although usually underrated by developers, background music and sound effects are an important part of any game. It sets up the mood and compliments the gameplay. But that's aesthetics. What we need to learn is how to set up background music and sound effects in Gideros.
Gideros API for playing sounds is pretty straightforward. First, we load sound by creating the Sound class instance.
local sound = Sound.new("mysound.mp3")And then we play this sound by calling the
sound:play() method.
In Gideros, a good practice is to use MP3 format for background music or sounds that do not require immediate play. This is because MP3 is a compressed format and more resources would be required to uncompress it.
For sound effects and other sounds that do require immediate play, you should use WAV files, because this file format is uncompressed and can be read and played immediately.
But what we need to do is to provide the ability to turn the sounds off and on as well. So what we will do here...
Change the font size
Change margin width
Change background colour