Time for action – playing a sound at position

We are going to use the pan parameter of the playEffect: method to play the sound effect when a bird is hit at the position where the bird was actually hit. For example, when the bird is on the left-hand side of the screen and if it is hit, the sound will be louder in the left headphone, and when the bird is on the right-hand side of the screen and if it is hit, the sound will be played louder in the right headphone. The farther the bird is from the center of the screen, the higher the volume will be of the sound in the corresponding headphone. To test this, you will require headphones. Now perform the following steps:

  1. Open the AudioManager.h file and add the following method declaration:
    -(void)playSoundEffect:(NSString ...

Get Learning iPhone Game Development with Cocos2D 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.