Skip to content

Commit

Permalink
Adding some sounds
Browse files Browse the repository at this point in the history
  • Loading branch information
fadookie committed Apr 2, 2012
1 parent 37ef2cd commit 482bff9
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 12 deletions.
Binary file added Assets/Sounds/tear_in_case.wav
Binary file not shown.
4 changes: 4 additions & 0 deletions Maestro.xcodeproj/project.pbxproj
Expand Up @@ -272,6 +272,7 @@
73733C5815292D3000992747 /* teardrop_2.wav in Resources */ = {isa = PBXBuildFile; fileRef = 73733C4F15292D3000992747 /* teardrop_2.wav */; }; 73733C5815292D3000992747 /* teardrop_2.wav in Resources */ = {isa = PBXBuildFile; fileRef = 73733C4F15292D3000992747 /* teardrop_2.wav */; };
73733C5C15292D3800992747 /* Death_Theme.wav in Resources */ = {isa = PBXBuildFile; fileRef = 73733C5A15292D3800992747 /* Death_Theme.wav */; }; 73733C5C15292D3800992747 /* Death_Theme.wav in Resources */ = {isa = PBXBuildFile; fileRef = 73733C5A15292D3800992747 /* Death_Theme.wav */; };
73733C5D15292D3800992747 /* win_theme.wav in Resources */ = {isa = PBXBuildFile; fileRef = 73733C5B15292D3800992747 /* win_theme.wav */; }; 73733C5D15292D3800992747 /* win_theme.wav in Resources */ = {isa = PBXBuildFile; fileRef = 73733C5B15292D3800992747 /* win_theme.wav */; };
73733C8A1529429200992747 /* tear_in_case.wav in Resources */ = {isa = PBXBuildFile; fileRef = 73733C891529429200992747 /* tear_in_case.wav */; };
/* End PBXBuildFile section */ /* End PBXBuildFile section */


/* Begin PBXFileReference section */ /* Begin PBXFileReference section */
Expand Down Expand Up @@ -723,6 +724,7 @@
73733C4F15292D3000992747 /* teardrop_2.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = teardrop_2.wav; sourceTree = "<group>"; }; 73733C4F15292D3000992747 /* teardrop_2.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = teardrop_2.wav; sourceTree = "<group>"; };
73733C5A15292D3800992747 /* Death_Theme.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = Death_Theme.wav; sourceTree = "<group>"; }; 73733C5A15292D3800992747 /* Death_Theme.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = Death_Theme.wav; sourceTree = "<group>"; };
73733C5B15292D3800992747 /* win_theme.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = win_theme.wav; sourceTree = "<group>"; }; 73733C5B15292D3800992747 /* win_theme.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = win_theme.wav; sourceTree = "<group>"; };
73733C891529429200992747 /* tear_in_case.wav */ = {isa = PBXFileReference; lastKnownFileType = audio.wav; path = tear_in_case.wav; sourceTree = "<group>"; };
/* End PBXFileReference section */ /* End PBXFileReference section */


/* Begin PBXFrameworksBuildPhase section */ /* Begin PBXFrameworksBuildPhase section */
Expand Down Expand Up @@ -841,6 +843,7 @@
0B1A470D1527A0F70062DECC /* Sounds */ = { 0B1A470D1527A0F70062DECC /* Sounds */ = {
isa = PBXGroup; isa = PBXGroup;
children = ( children = (
73733C891529429200992747 /* tear_in_case.wav */,
0B89115615293C3900067C96 /* teardrop_1.wav */, 0B89115615293C3900067C96 /* teardrop_1.wav */,
73733C4715292D3000992747 /* menu_1.wav */, 73733C4715292D3000992747 /* menu_1.wav */,
73733C4815292D3000992747 /* menu_2.wav */, 73733C4815292D3000992747 /* menu_2.wav */,
Expand Down Expand Up @@ -1618,6 +1621,7 @@
0B8911531529385100067C96 /* Title-Card.png in Resources */, 0B8911531529385100067C96 /* Title-Card.png in Resources */,
0B89115715293C3900067C96 /* teardrop_1.wav in Resources */, 0B89115715293C3900067C96 /* teardrop_1.wav in Resources */,
0B89116815293FE600067C96 /* Intro-Card.png in Resources */, 0B89116815293FE600067C96 /* Intro-Card.png in Resources */,
73733C8A1529429200992747 /* tear_in_case.wav in Resources */,
); );
runOnlyForDeploymentPostprocessing = 0; runOnlyForDeploymentPostprocessing = 0;
}; };
Expand Down
4 changes: 1 addition & 3 deletions Maestro/GameLayer.m
Expand Up @@ -147,9 +147,7 @@ -(void)update:(ccTime) delta
cpShape *shape = cpSpacePointQueryFirst([Physics sharedInstance].space, vect, CP_ALL_LAYERS, CP_NO_GROUP); cpShape *shape = cpSpacePointQueryFirst([Physics sharedInstance].space, vect, CP_ALL_LAYERS, CP_NO_GROUP);


if ((NULL != shape) && (NULL != shape->body)) { if ((NULL != shape) && (NULL != shape->body)) {
#warning test sound play [[GameSoundManager sharedInstance].soundEngine playEffect:SOUND_TEAR1];
//[[GameSoundManager sharedInstance].soundEngine playEffect:@"zap.wav"];
[[GameSoundManager sharedInstance].soundEngine playEffect:@"teardrop_1.wav"];


//Get a vector from the shape to the touch point and use that as the start for our physics impulse //Get a vector from the shape to the touch point and use that as the start for our physics impulse
cpVect j = cpvsub(cpBodyGetPos(shape->body), vect); cpVect j = cpvsub(cpBodyGetPos(shape->body), vect);
Expand Down
2 changes: 1 addition & 1 deletion Maestro/GameScene.m
Expand Up @@ -124,7 +124,7 @@ -(void) update:(ccTime) delta
if (!_maestroAudioStarted && if (!_maestroAudioStarted &&
[[GameClock sharedInstance] currentTime] > _maestroAudioStartTime) { [[GameClock sharedInstance] currentTime] > _maestroAudioStartTime) {
NSLog(@"Starting Maestro music."); NSLog(@"Starting Maestro music.");
//[[GameSoundManager sharedInstance] playMaestro]; [[GameSoundManager sharedInstance] playMaestro];
_maestroAudioStarted = YES; _maestroAudioStarted = YES;
} }
} }
Expand Down
5 changes: 5 additions & 0 deletions Maestro/GameSoundManager.h
Expand Up @@ -2,6 +2,11 @@


//#define SOUND_CRASH @"crash.wav" //#define SOUND_CRASH @"crash.wav"
//#define SOUND_DEFEAT @"defeat.wav" //#define SOUND_DEFEAT @"defeat.wav"
#define SOUND_TEAR1 @"teardrop_1.wav"
#define SOUND_TEAR2 @"teardrop_2.wav"
#define SOUND_TEAR_CASE @"tear_in_case.wav"
#define SOUND_STORE_REGISTER @"store_register.wav"
#define SOUND_MENU_1 @"menu_1.wav"


typedef enum { typedef enum {
kGSUninitialised, kGSUninitialised,
Expand Down
12 changes: 6 additions & 6 deletions Maestro/GameSoundManager.m
Expand Up @@ -14,15 +14,15 @@ @implementation GameSoundManager
//If you don't preload your sounds there will be a delay before they are played the first time while the sound data //If you don't preload your sounds there will be a delay before they are played the first time while the sound data
//is loaded to the playback buffer //is loaded to the playback buffer
-(void) preload { -(void) preload {

[soundEngine_ preloadEffect:SOUND_TEAR1];
// [soundEngine_ preloadEffect:SOUND_CRASH]; [soundEngine_ preloadEffect:SOUND_TEAR2];
// [soundEngine_ preloadEffect:SOUND_DEFEAT]; [soundEngine_ preloadEffect:SOUND_TEAR_CASE];
[soundEngine_ preloadEffect:@"store_register.wav"]; [soundEngine_ preloadEffect:SOUND_STORE_REGISTER];

[soundEngine_ preloadEffect:SOUND_MENU_1];

//Preload the background music too but there is no point in preloading multiple background music files so only //Preload the background music too but there is no point in preloading multiple background music files so only
//preload the first one you will play //preload the first one you will play
[soundEngine_ preloadBackgroundMusic:@"title.wav"]; [soundEngine_ preloadBackgroundMusic:@"title.wav"];
[soundEngine_ preloadEffect:@"teardrop_1.wav"];
} }


//TODO: modify these parameters to your own taste, e.g you may want a longer fade out or a different type of curve //TODO: modify these parameters to your own taste, e.g you may want a longer fade out or a different type of curve
Expand Down
4 changes: 2 additions & 2 deletions Maestro/StoreLayer.m
Expand Up @@ -145,8 +145,7 @@ - (void)buyStoreItem:(StoreItem *)item
gameManager.tearsCollectedTotal = gameManager.tearsCollectedTotal - item.price; gameManager.tearsCollectedTotal = gameManager.tearsCollectedTotal - item.price;
[gameManager.purchasedItems addObject:item]; [gameManager.purchasedItems addObject:item];


[[GameSoundManager sharedInstance].soundEngine playEffect:@"store_register.wav"]; [[GameSoundManager sharedInstance].soundEngine playEffect:SOUND_STORE_REGISTER];

[self updateMenu]; [self updateMenu];


[self.devil animateForPurchase]; [self.devil animateForPurchase];
Expand Down Expand Up @@ -177,6 +176,7 @@ - (void)updateMenu


- (void)doneStore - (void)doneStore
{ {
[[GameSoundManager sharedInstance].soundEngine playEffect:SOUND_MENU_1];
GameManager *gameManager = [GameManager sharedInstance]; GameManager *gameManager = [GameManager sharedInstance];
NSInteger nextLevelNum = gameManager.currentLevelNum + 1; NSInteger nextLevelNum = gameManager.currentLevelNum + 1;
[[CCDirector sharedDirector] replaceScene:[CCTransitionCrossFade transitionWithDuration:0.5f scene:[GameScene nodeWithLevelNum:nextLevelNum]]]; [[CCDirector sharedDirector] replaceScene:[CCTransitionCrossFade transitionWithDuration:0.5f scene:[GameScene nodeWithLevelNum:nextLevelNum]]];
Expand Down
2 changes: 2 additions & 0 deletions Maestro/Tear.m
Expand Up @@ -11,6 +11,7 @@
#import "GameUtils.h" #import "GameUtils.h"
#import "Physics.h" #import "Physics.h"
#import "Tear.h" #import "Tear.h"
#import "GameSoundManager.h"


#define MIN_LIFE 4.0 #define MIN_LIFE 4.0
#define MAX_LIFE 10.0 #define MAX_LIFE 10.0
Expand Down Expand Up @@ -98,6 +99,7 @@ - (void)die
- (void)hitBin - (void)hitBin
{ {
if (!self.isDead) { if (!self.isDead) {
[[GameSoundManager sharedInstance].soundEngine playEffect:SOUND_TEAR_CASE];
GameManager *manager = [GameManager sharedInstance]; GameManager *manager = [GameManager sharedInstance];
[manager playerCollectedTear]; [manager playerCollectedTear];
[self die]; [self die];
Expand Down

0 comments on commit 482bff9

Please sign in to comment.