Game Development Reference
In-Depth Information
//Whenever the player picks up any bonus on the map,
//he/she is rewarded with points to add to his/her score.
//Parameters:
// bonusId - bonus ID. 3 - gift box, 4 - nut, 5 - cherry
// row - the row# of the bonus
// col - the col# of the bonus
public void getReward( int bonusId, int row, int col){
int imgid = 0;
int inc = 1;
Point p = new Point(col,row);
delPoints.add(p);
if (bonusId == 3) {
imgid = 11; //Perfect
inc = 20;
bonus++;
if (bonus < MAX_BONUS) father.playSound(GOOD_SOUND, 0);
}
else if (bonusId == 4){
inc = 1;
father.playSound(SCORE_SOUND, 0);
}
else if (bonusId == 5){
imgid = 10; //Good Job
inc = 5;
father.playSound(GOOD_SOUND, 0);
}
score += inc;
Score s = new Score(inc,imgid,col*TILE_SIZE,row*TILE_SIZE);
addScore.add(s);
if (bonus == MAX_BONUS) { //PASS
father.playSound(PASS_SOUND, 0);
pauseGame();
if (currStage<MAX_STAGE-1)
currStage++;
else currStage = 0;
setGameState(STATE_PASS);
}
}
Search WWH ::




Custom Search