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

Commit

Permalink
jauge
Browse files Browse the repository at this point in the history
  • Loading branch information
biou committed Jan 27, 2013
1 parent 1abaa4a commit ce31875
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 14 deletions.
4 changes: 4 additions & 0 deletions GGJ13/Drugs&Rock.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@
329D369216B56936001BDACA /* OrchestreFBI.aifc in Resources */ = {isa = PBXBuildFile; fileRef = 329D369116B56936001BDACA /* OrchestreFBI.aifc */; };
329D369516B56D55001BDACA /* ECGFast.aifc in Resources */ = {isa = PBXBuildFile; fileRef = 329D369316B56D55001BDACA /* ECGFast.aifc */; };
329D369616B56D55001BDACA /* ECGSlow.aifc in Resources */ = {isa = PBXBuildFile; fileRef = 329D369416B56D55001BDACA /* ECGSlow.aifc */; };
329D369816B57543001BDACA /* Win.caf in Resources */ = {isa = PBXBuildFile; fileRef = 329D369716B57543001BDACA /* Win.caf */; };
32A1C0E216B424D600B4DEF3 /* bouton-off.png in Resources */ = {isa = PBXBuildFile; fileRef = 32A1C0DD16B424D600B4DEF3 /* bouton-off.png */; };
32A1C0E316B424D600B4DEF3 /* bouton-on-no.png in Resources */ = {isa = PBXBuildFile; fileRef = 32A1C0DE16B424D600B4DEF3 /* bouton-on-no.png */; };
32A1C0E416B424D600B4DEF3 /* bouton-on-yes.png in Resources */ = {isa = PBXBuildFile; fileRef = 32A1C0DF16B424D600B4DEF3 /* bouton-on-yes.png */; };
Expand Down Expand Up @@ -404,6 +405,7 @@
329D369116B56936001BDACA /* OrchestreFBI.aifc */ = {isa = PBXFileReference; lastKnownFileType = file; name = OrchestreFBI.aifc; path = Resources/OrchestreFBI.aifc; sourceTree = "<group>"; };
329D369316B56D55001BDACA /* ECGFast.aifc */ = {isa = PBXFileReference; lastKnownFileType = file; name = ECGFast.aifc; path = Resources/ECGFast.aifc; sourceTree = "<group>"; };
329D369416B56D55001BDACA /* ECGSlow.aifc */ = {isa = PBXFileReference; lastKnownFileType = file; name = ECGSlow.aifc; path = Resources/ECGSlow.aifc; sourceTree = "<group>"; };
329D369716B57543001BDACA /* Win.caf */ = {isa = PBXFileReference; lastKnownFileType = file; name = Win.caf; path = Resources/Win.caf; sourceTree = "<group>"; };
32A1C0DD16B424D600B4DEF3 /* bouton-off.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "bouton-off.png"; path = "Resources/bouton-off.png"; sourceTree = "<group>"; };
32A1C0DE16B424D600B4DEF3 /* bouton-on-no.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "bouton-on-no.png"; path = "Resources/bouton-on-no.png"; sourceTree = "<group>"; };
32A1C0DF16B424D600B4DEF3 /* bouton-on-yes.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "bouton-on-yes.png"; path = "Resources/bouton-on-yes.png"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -639,6 +641,7 @@
324254BC168DDFB40050EDD1 /* Resources */ = {
isa = PBXGroup;
children = (
329D369716B57543001BDACA /* Win.caf */,
329D369316B56D55001BDACA /* ECGFast.aifc */,
329D369416B56D55001BDACA /* ECGSlow.aifc */,
329D369116B56936001BDACA /* OrchestreFBI.aifc */,
Expand Down Expand Up @@ -1346,6 +1349,7 @@
329D369216B56936001BDACA /* OrchestreFBI.aifc in Resources */,
329D369516B56D55001BDACA /* ECGFast.aifc in Resources */,
329D369616B56D55001BDACA /* ECGSlow.aifc in Resources */,
329D369816B57543001BDACA /* Win.caf in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down
Binary file added GGJ13/GGJ13/Resources/Win.caf
Binary file not shown.
2 changes: 1 addition & 1 deletion GGJ13/GGJ13/WHBasicLayer.mm
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ - (id)init {
break;
case whWin:
image = @"win.png";
son = @"";
son = @"Win.caf";
break;

/*
Expand Down
2 changes: 2 additions & 0 deletions GGJ13/GGJ13/WHGameScene.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
@property (strong) WHPauseLayer * pauseLayer;
@property (strong) GCDAsyncSocket * socket;
@property (strong) NSMutableArray * ziques;
@property (strong) CCSprite * jauge;
@property (strong) CCSprite * jaugeRival;


-(void) incrementBPM:(int)bpm;
Expand Down
34 changes: 21 additions & 13 deletions GGJ13/GGJ13/WHGameScene.mm
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ @implementation WHGameScene
@synthesize socket;
@synthesize ziques;
@synthesize headerLayer;
@synthesize jauge;
@synthesize jaugeRival;


+(WHGameScene *) scene:(int) m
Expand Down Expand Up @@ -120,6 +122,15 @@ -(void)initGame {
bgpic2.position = ccp(s.width/2.0, s.height-48);
[headerLayer addChild:bgpic2];
[self addChild:headerLayer z:+10];

jauge = [CCSprite spriteWithSpriteFrameName:@"jauge-0.png"];
jauge.position = ccp(50, s.height-60);
[headerLayer addChild: jauge z:11 tag:14];
jaugeRival = [CCSprite spriteWithSpriteFrameName:@"rival-jauge-0.png"];
jaugeRival.position = ccp(s.width-50, s.height-60);
[headerLayer addChild: jaugeRival z:11 tag:15];


[self setBPM: 80];

score = 0;
Expand Down Expand Up @@ -262,11 +273,6 @@ -(int) getGameBPM {
return gameBPM;
}

-(void) updateJaugeWith:(int)statut {
NSLog(@"Update jauge with statut %d (0,1,2,3)", statut);
NSLog(@"--> Fix me baby one more time!");
}

-(void) sendDrug:(int)itemType {
NSLog(@"Envoi de drogue à l’autre connard: type %d",itemType);
[self sendSocketWithKey:@"faitmanger" andValue:[NSString stringWithFormat:@"%d",itemType]];
Expand Down Expand Up @@ -384,14 +390,16 @@ -(void) updateHeaderScore {
[headerLayer addChild: label z:1 tag:12];
}

-(void) updateJauge {
[headerLayer removeChildByTag:12 cleanup:true];
CGSize winsize = [CCDirector sharedDirector].winSize;
int fontSize = 16;
CCLabelTTF *label = [CCLabelTTF labelWithString:[NSString stringWithFormat:@"%d", score] fontName:@"DBLCDTempBlack" fontSize:fontSize];
[label setColor:ccc3(181, 216, 19)];
[label setPosition: ccp(60, winsize.height-34)];
[headerLayer addChild: label z:1 tag:12];
-(void) updateJaugeWith:(int)statut {
if (statut>=0 && statut <4) {
[jauge setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"jauge-%d.png",statut]]];
}
}

-(void) updateRivalJauge:(int)i {
if (i>=0 && i <4) {
[jaugeRival setDisplayFrame:[[CCSpriteFrameCache sharedSpriteFrameCache] spriteFrameByName:[NSString stringWithFormat:@"jauge-%d.png",i]]];
}
}


Expand Down

0 comments on commit ce31875

Please sign in to comment.