Skip to content

Commit

Permalink
feat : improve gameplay
Browse files Browse the repository at this point in the history
  • Loading branch information
willylambert committed Jun 23, 2018
1 parent 903f2b3 commit d478b00
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 37 deletions.
12 changes: 6 additions & 6 deletions CameraView.pde
Expand Up @@ -93,11 +93,11 @@ public class CameraView extends PApplet {

public void settings(){
size(kCAM_WIDTH*2, kCAM_HEIGHT);
_goSoundfile = new Movie(this, gDataPath + "\\go.wav");
_touchSoundfile = new Movie(this, gDataPath + "\\touch.wav");
_endSoundfile = new Movie(this, gDataPath + "\\end.wav");
_winSoundfile = new Movie(this, gDataPath + "\\win.wav");
_looserSoundfile = new Movie(this,gDataPath + "\\looser.wav");
_goSoundfile = new Movie(this, gDataPath + File.separator + "go.wav");
_touchSoundfile = new Movie(this, gDataPath + File.separator +"touch.wav");
_endSoundfile = new Movie(this, gDataPath + File.separator + "end.wav");
_winSoundfile = new Movie(this, gDataPath + File.separator + "win.wav");
_looserSoundfile = new Movie(this,gDataPath + File.separator + "looser.wav");
}

public void setup(){
Expand Down Expand Up @@ -453,7 +453,7 @@ public class CameraView extends PApplet {
}
}

// dead hold touched
// dead skull hold touched
if(bDoNotTouchTouched){
// Restart game without reseting timer
gWall.restartGame();
Expand Down
3 changes: 2 additions & 1 deletion HallOfFame.pde
Expand Up @@ -55,6 +55,7 @@ class HallOfFame{
void display(PGraphics g){
g.background(0);
g.fill(255);
g.textSize(40);
for(int i=0;i<_levels.size();i++){
int j = 0;
g.text("Niveau " + (i+1),25+i*g.width/3,(j+1)*75);
Expand All @@ -66,4 +67,4 @@ class HallOfFame{
}
}

}
}
24 changes: 5 additions & 19 deletions TheWall.pde
Expand Up @@ -43,19 +43,15 @@ class TheWall extends PApplet {
HallOfFame _hallOfFame;
ReadyToGo _readyToGo;

// Used to display restart label during 2 sec. this variable is used as a countdown
int _showRestartLabel;

int _remainingGreenDots;

int _level;

// Instructions for player
// Instructions for climber
String _instructions = "";

TheWall(int fullscreenMode) {
_fullscreenMode = fullscreenMode;
_showRestartLabel = 0;
_bShowHallOfFame = false;
_bRecordNewWall = false;
_bReadyToGo = false;
Expand Down Expand Up @@ -165,14 +161,10 @@ class TheWall extends PApplet {
}

/**
* When climber touch a do not touch area
* When climber touch a dead skull hold
**/
void restartGame() {
_bReadyToGo = false;
if(_calibrationMode==Calibration.kCALIBRATION_VP){
_showRestartLabel = 100;
}
_bGameWon = false;
startGame();
}

/**
Expand Down Expand Up @@ -290,18 +282,12 @@ class TheWall extends PApplet {
_readyToGo.display(g,frameCount);
}
}

if (_showRestartLabel>0) {
String msg = "On recommence, le chrono tourne !";
_showRestartLabel--;
fill(255);
text(msg, (width/2)-textWidth(msg)/2, height/2);
}


}else{
//Game Won !!
String msg = "Bravo, pas mal... " + nf(_gameWonTime/1000., 0, 1) + " secondes !!";
fill(255);
textSize(100);
text(msg, (width/2)-textWidth(msg)/2, height/4);
}
}
Expand Down
30 changes: 19 additions & 11 deletions UIControl.pde
Expand Up @@ -77,9 +77,7 @@ public class UIControl extends PApplet {
size(1024, 240);
}

public void setup() {
frameRate(10);

public void setup() {
// Default font
_font = gFont;
this.g.textFont(_font);
Expand Down Expand Up @@ -337,13 +335,23 @@ public class UIControl extends PApplet {
if(code != ENTER){
_playerName += ch;
}else{
println(_playerName + " won in " + _theWall.getWonTime() + " ms");
_hallOfFame.add(_theWall.getLevel(), _theWall.getWonTime(), _playerName);
_theWall.displayHallOfFame(_hallOfFame);
_btnGoLevel1.setVisible(true);
_btnGoLevel2.setVisible(true);
_btnGoLevel3.setVisible(true);
_bGetPlayerName = false;
if(_bGetPlayerName){
println(_playerName + " won in " + _theWall.getWonTime() + " ms");
_hallOfFame.add(_theWall.getLevel(), _theWall.getWonTime(), _playerName);
_theWall.displayHallOfFame(_hallOfFame);
_btnGoLevel1.setVisible(true);
if(_currentWallIndex != kUSE_COLOR_STICKERS){
_btnGoLevel2.setVisible(true);
_btnGoLevel3.setVisible(true);
}
_bGetPlayerName = false;
}else{
// Enter start a new game
_theWall.startGame();
_camView.play();
_btnStop.setVisible(true);
_theWall.setInstructions("TOUCHE UNE PREMIERE PRISE POUR LANCER LE CHRONO");
}
}
}

Expand Down Expand Up @@ -378,7 +386,7 @@ public class UIControl extends PApplet {
_sensivityScrollBar.display();

fill(0);
text("Motion sensivity : ",_btnCameraList.size()*230+155,10);
text("Motion sensivity : ",_btnCameraList.size()*230+155,20);

textAlign(LEFT);
text("Capture Device : ",20,15);
Expand Down

0 comments on commit d478b00

Please sign in to comment.