Sound effect always is very important part of Game, I used to use other library that playing sound effect on iPhone App, but it totally make the size of the game bigger and slower. Now, I have move my game design from Cocoa To Cocos2d and it's include a few audio playing library. since I just need a background music and some sound effect, so I have choose SimpleAudioEngine.
Steps for playing background music
1. add your sound effect file to project (e.g. BG.mp3)
2. add header file to AppDelegate
#import "SimpleAudioEngine.h"
3. make sure you have add "SimpleAudioEngine.h" and "SimpleAudioEngine.m" from cocos2d
because I want to play the backgrund music after the app have finish loading. so I have make following change for applicationDidFinishLaunching
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"BG.mp3"];
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
...
}
and Now, if we want to play a sound effect when user tap the button, we should preload the sound effect file on app delegate first, or any function before you play it.
- (void) applicationDidFinishLaunching:(UIApplication*)application
{
[[SimpleAudioEngine sharedEngine] playBackgroundMusic:@"BG.mp3"];
[[SimpleAudioEngine sharedEngine] preloadEffect:@"tapBtn.mp3"];\
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
...
}
and play it when you need it
-(void)tapButton:(id)sender
{
[audioEngine playEffect:@"tapBtn.mp3"];
}
Cocos2d SimpleAudioEngine Example
張貼者:
Ivan Ke
on 2009年9月22日 星期二
標籤:
Cocos2d SimpleAudioEngine Example
/
Comments: (0)
Mahjong Match 2
張貼者:
Ivan Ke
on 2009年9月18日 星期五
/
Comments: (1)
Mahjong Match 2, the new match game from Leung's work!
There is maximum have 200 pairs of Mahjong in different place and layer every time you start the game. The player will pairs by touching them.
If you find there is no Mahjong can be pair, you can shuffle the mahjong anytime. and there is a continue function added to Mahjong Match 2. The game have well prepare for iPhone and iPod Touch. Enjoy the relax and fun game.
Go Walk Pedometer 2.0
張貼者:
Ivan Ke
/
Comments: (0)
Fly Kingdom: Training
張貼者:
Ivan Ke
on 2009年8月3日 星期一
/
Comments: (0)
This is about the training before adventure team of fly kingdom, Fly kingdom is choosing the best team to explore the universe, and it will based on the best score in the ranking list. All member of fly kingdom will use this training include catching the energy coins and avoid any unidentified object danger for the fly. Try your best guide the fly member to catching the energy coin and avoid other object.
Back to Fly Kingdom
張貼者:
Ivan Ke
on 2009年7月27日 星期一
/
Comments: (0)
Photo Puzzle Fun
張貼者:
Ivan Ke
on 2009年7月19日 星期日
/
Comments: (0)
Photo Puzzle Fun 1.0
US$1.99 (GET IT NOW)
worry about you can't finish one puzzle each time? don't worry, photo puzzle game provide you a automatic save function, you can simply tap continue game to continue the puzzle you play last t
ime.
last but not least, you may worry your finger have cover the puzzle, the photo puzzle fun have provide you a zoom function which will zoom the area your figure cover the screen. hope you enjoy the well designed pu
zzle game Photo Puzzle Fun on your iPhone/iPod Touch.
video Demo:
Screen Capture: