hello everybody ,
I want to add a sound effect when a collision happens, for instance :
when the bird.frame touch the topcolumn , bottomcolumn or the ground.frame , I want to add a sound effect (It's a mp3 file during 1 sec)
hello everybody ,
I want to add a sound effect when a collision happens, for instance :
when the bird.frame touch the topcolumn , bottomcolumn or the ground.frame , I want to add a sound effect (It's a mp3 file during 1 sec)
if (CGRectIntersectsRect(bird.frame, topcolumn.frame)) {
[self Gameover];
scorenumber = 0;
// I want the song effect to play here
}
if (CGRectIntersectsRect(bird.frame, bottomcolumn.frame)) {
[self Gameover];
scorenumber = 0;
// I want the song effect to play here
}
if (CGRectIntersectsRect(bird.frame, ground.frame)) {
[self Gameover];
scorenumber = 0;
// I want the song effect to play here
}
Don't capitlize method names in ObjC. Renamed GameOver to gameOver.
You can use AVAudioPlayer h t t p s://developer.apple.com/reference/avfoundation/avaudioplayer
There also is the AudioToolbox framework.
Thank you very much for you help!