It is a common task in many games to provide the ON and OFF switch. The most common scenario that I always come across is turning sound and music on and off. We are going to use the same
CCButton class to add buttons to the
MenuScene class to allow a user to turn the sound and music on and off. To do this, perform the following steps:
Resourcesgroup. Then, open the book supporting files at
Chapter_09/Assets/SoundButtonsand add the button images to that newly created group.
AudioManager.hfile and add the following two properties that we'll use to check if the sound and music is enabled, and set the initial state of the buttons as follows:
@property (nonatomic, ...