O'Reilly logo

Cocos2d-x Game Development Essentials by Gareth Jones, Arutosh Gurung, Frahaan Hussain

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

Chapter 9. Adding Audio to the Game

This chapter will cover how Cocos2d-x handles the implementation of audio within a game. We will also cover the different types of audio available for use and how to implement them using sound files that will be provided. The sound will be played when certain conditions are met and methods are triggered.

The topics covered in this chapter are as follows:

  • Loading sound effects
  • Playing sound effects
  • Loading background music
  • Playing background music
  • Additional sound effect features
  • Additional background music features

Cocos2d-x along with many other engines supports two main types of audio implementation. They are as follows:

  • Sound effects: This is used to play a short file, which could be repeated several times. For example, ...

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