mis en place la PR de simon sur les couleurs
This commit is contained in:
@@ -4,7 +4,10 @@
|
||||
#include "Player.h"
|
||||
|
||||
|
||||
GameParameters::GameParameters(Gamemode gamemode, const Player& controls) : gamemode(gamemode), controls(controls) {
|
||||
GameParameters::GameParameters(Gamemode gamemode, const Player& controls) :
|
||||
gamemode(gamemode),
|
||||
controls(controls) {
|
||||
|
||||
// initialize lines and level
|
||||
this->clearedLines = 0;
|
||||
switch (this->gamemode) {
|
||||
@@ -85,34 +88,37 @@ void GameParameters::updateStats() {
|
||||
}
|
||||
|
||||
/* GRAVITY */
|
||||
if (level >= 20) {
|
||||
// all levels above 20 are instant gravity
|
||||
this->gravity = 20 * 60;
|
||||
// get gravity for an assumed 20-rows board
|
||||
static const int gravityPerLevel[] = {
|
||||
0, // LVL0
|
||||
1, // 60f/line, 20s total
|
||||
2, // 30f/line, 10s total
|
||||
3, // 20f/line, 6.66s total
|
||||
4, // 15f/line, 5s total
|
||||
5, // 12f/line, 4s total
|
||||
6, // 10f/line, 3.33 total
|
||||
7, // 8.57f/line, 2.85s total
|
||||
8, // 7.5f/line, 2.5s total
|
||||
10, // 6f/line, 2s total
|
||||
12, // 5f/line, 1.66s total
|
||||
14, // 4.28f/line, 1.42s total
|
||||
17, // 3.52f/line, 1.17s total
|
||||
20, // 3f/line, 60f total
|
||||
24, // 2.5f/line, 50f total
|
||||
30, // 2f/line, 40f total
|
||||
40, // 1.5f/line, 30f total
|
||||
1 * 60, // 1line/f, 20f total
|
||||
2 * 60, // 2line/f, 10f total
|
||||
4 * 60 // 4line/f, 5f total
|
||||
};
|
||||
if (this->level < 0) {
|
||||
this->gravity = gravityPerLevel[0];
|
||||
}
|
||||
else if (this->gravity > 20) {
|
||||
this->gravity = gravityPerLevel[20];
|
||||
}
|
||||
else {
|
||||
// get gravity for an assumed 20-rows board
|
||||
switch (this->level) {
|
||||
case 1 : {this->gravity = 1; break;} // 60f/line, 20s total
|
||||
case 2 : {this->gravity = 2; break;} // 30f/line, 10s total
|
||||
case 3 : {this->gravity = 3; break;} // 20f/line, 6.66s total
|
||||
case 4 : {this->gravity = 4; break;} // 15f/line, 5s total
|
||||
case 5 : {this->gravity = 5; break;} // 12f/line, 4s total
|
||||
case 6 : {this->gravity = 6; break;} // 10f/line, 3.33 total
|
||||
case 7 : {this->gravity = 7; break;} // 8.57f/line, 2.85s total
|
||||
case 8 : {this->gravity = 8; break;} // 7.5f/line, 2.5s total
|
||||
case 9 : {this->gravity = 10; break;} // 6f/line, 2s total
|
||||
case 10 : {this->gravity = 12; break;} // 5f/line, 1.66s total
|
||||
case 11 : {this->gravity = 14; break;} // 4.28f/line, 1.42s total
|
||||
case 12 : {this->gravity = 17; break;} // 3.52f/line, 1.17s total
|
||||
case 13 : {this->gravity = 20; break;} // 3f/line, 60f total
|
||||
case 14 : {this->gravity = 24; break;} // 2.5f/line, 50f total
|
||||
case 15 : {this->gravity = 30; break;} // 2f/line, 40f total
|
||||
case 16 : {this->gravity = 40; break;} // 1.5f/line, 30f total
|
||||
case 17 : {this->gravity = 1 * 60; break;} // 1line/f, 20f total
|
||||
case 18 : {this->gravity = 2 * 60; break;} // 2line/f, 10f total
|
||||
case 19 : {this->gravity = 4 * 60; break;} // 4line/f, 5f total
|
||||
default : this->gravity = 1;
|
||||
}
|
||||
this->gravity = gravityPerLevel[this->level];
|
||||
}
|
||||
|
||||
/* LOCK DELAY */
|
||||
|
||||
Reference in New Issue
Block a user