O'Reilly logo

LibGDX Game Development By Example by James Cook

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

Let's make some noise

So far, across all the games we have made, we can note that they all have something in common. They are completely silent! As any good game-maker knows, sounds and music add an awful lot to the experience. What we are going to look at now is how to use LibGDX to introduce sounds to our simple platform.

Before we dive into coding up some beeps and boops, let's first look at how LibGDX handles making sounds!

Sound effects

LibGDX splits the handling of audio into two parts. The first part is the sound effects with smaller audio files and the second part is the music, which generally has larger audio files. We will start off with looking at the Sound class of LibGDX, the one that looks after the smaller sound effects.

According to ...

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