Skip to content
This repository has been archived by the owner on May 7, 2021. It is now read-only.

Commit

Permalink
bug
Browse files Browse the repository at this point in the history
  • Loading branch information
biou committed Jan 27, 2013
1 parent 27edcd3 commit b74a722
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
1 change: 1 addition & 0 deletions GGJ13/GGJ13/WHGameScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
int gameBPM;
int rivalBPM;
int score;
bool started;
}

@property (strong) WHGameLayer * gameLayer;
Expand Down
30 changes: 17 additions & 13 deletions GGJ13/GGJ13/WHGameScene.mm
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#import "WHGameScene.h"
#import "WHBasicLayer.h"

#define LEVEL_INITIAL 1
#define LEVEL_INITIAL 0


static int gameMode;
Expand Down Expand Up @@ -85,13 +85,11 @@ - (id)init {
return self;
}

-(void)initGame {
[self setBPM: 80];

-(void)initGame {
//[gameLayer setGameScene:self];
//[controlLayer setGameScene:self];
//[pauseLayer setControlLayer:controlLayer];
currentZique = 0;
currentZique = 1;
ziques = [NSMutableArray arrayWithCapacity:2];
NSDictionary * zique1 = [NSDictionary dictionaryWithObjectsAndKeys:[NSNumber numberWithInt:70], @"bpm", @"", @"intro", @"ReggaeDev-70bpm.aifc", @"loop", [NSNumber numberWithFloat:82.0], @"loopLen", [NSNumber numberWithFloat:0.0], @"introLen", nil];
[ziques addObject:zique1];
Expand Down Expand Up @@ -121,7 +119,7 @@ -(void)initGame {
bgpic2.position = ccp(s.width/2.0, s.height-48);
[headerLayer addChild:bgpic2];
[self addChild:headerLayer z:+10];
[self updateHeaderBPM];
[self setBPM: 80];

score = 0;
[self updateHeaderScore];
Expand Down Expand Up @@ -216,6 +214,7 @@ -(void) ziqueUpdate:(int) zique {
[audioManager stopBGM];

NSDictionary * bob = [ziques objectAtIndex:zique];
NSLog(@"bob: %@", bob);

[audioManager playBGMWithIntro:[bob objectForKey:@"intro"] andLoop:[bob objectForKey:@"loop"]];

Expand Down Expand Up @@ -263,6 +262,8 @@ -(void) sendDrug:(int)itemType {

-(void) setBPM:(int)bpm {
gameBPM=bpm;
[self updateHeaderBPM];
[self updateMusicBPM];
if ((bpm > 220) || (bpm < 50)) {
[self sendSocketWithKey:@"bye" andValue:@"1"];
[[CCDirector sharedDirector] replaceScene: [CCTransitionFade transitionWithDuration:0.5f scene: [WHBasicLayer scene:whGameover]]];
Expand Down Expand Up @@ -293,19 +294,22 @@ -(void) simulateBPM:(ccTime) dt {
}

-(int) ziqueWithBPM:(int) bpm {
if (bpm< 80) {
return 0;
int val = 0;
if (bpm< 70) {
val = 0;
} else if (bpm < 105){
return 1;
val = 1;
} else if (bpm < 135) {
return 2;
val = 2;
} else if (bpm < 158) {
return 3;
val = 3;
} else if (bpm < 176) {
return 4;
val = 4;
} else {
return 5;
val = 5;
}
NSLog(@"ziqueWithBPM: %d %d", bpm, val);
return val;
}

-(void) updateMusicBPM {
Expand Down

0 comments on commit b74a722

Please sign in to comment.