Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Gideros Mobile Game Development

You're reading from  Gideros Mobile Game Development

Product type Book
Published in Nov 2013
Publisher Packt
ISBN-13 9781849696708
Pages 154 pages
Edition 1st Edition
Languages
Author (1):
Arturs Sosins Arturs Sosins
Profile icon Arturs Sosins

Table of Contents (12) Chapters

Gideros Mobile Game Development
Credits
Foreword
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Setting Up the Environment 2. Managing Scenes and Gideros OOP 3. Implementing Game Logic 4. Polishing the Game Index

Adding sounds


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.

Note

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}