-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Mastering Cocos2d Cross-Platform Game Development
By :
Right now, we have sound effects and music playing all the time no matter what. Even though you might be someone who enjoys listening to sounds or music, when you design your games (as it's definitely an element that increases user engagement), you would want to be open to the fact that people just don't like to hear any sound at times. Thus, we must give them the option to turn the sound on and off.
Since we don't have a pause screen, options, settings, or anything similar, we're going to add the buttons to turn the sound on and off to the main menu. This means that a lot less code is required to add the buttons, instead of creating an entirely new scene exclusively for them. This arrangement also stays consistent with the clean feel of the game.
If you want to make a pause screen and add these two buttons to it, then go ahead by all means. The code, however, will be slightly different from what will be described here because...
Change the font size
Change margin width
Change background colour