TETRIS: add variable scores based on number of lines destroyed
This commit is contained in:
parent
b6a2e14507
commit
9890da4e06
@ -419,11 +419,11 @@ void mainSceneInput( std::shared_ptr< SDLPP::Scene > scene, int base, std::vecto
|
||||
moveThem( scene, SDL_GetTicks() - base );
|
||||
return;
|
||||
}
|
||||
short lines = 0;
|
||||
for ( auto &colider : line_coliders ) {
|
||||
auto collisions = scene->getCollisions( *colider, { BRICK_ID } );
|
||||
while ( collisions.size() == 10 ) {
|
||||
g_score += 10;
|
||||
g_update_score = true;
|
||||
lines += 1;
|
||||
for ( auto &col : collisions ) {
|
||||
col->destroy();
|
||||
}
|
||||
@ -442,6 +442,24 @@ void mainSceneInput( std::shared_ptr< SDLPP::Scene > scene, int base, std::vecto
|
||||
collisions = scene->getCollisions( *colider, { BRICK_ID } );
|
||||
}
|
||||
}
|
||||
if(lines > 0) {
|
||||
g_update_score = true;
|
||||
switch(lines) {
|
||||
case 1:
|
||||
g_score += 40;
|
||||
break;
|
||||
case 2:
|
||||
g_score += 100;
|
||||
break;
|
||||
case 3:
|
||||
g_score += 300;
|
||||
break;
|
||||
case 4:
|
||||
g_score += 1200;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
g_checked_line = true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user