Skip to content

Commit

Permalink
Change score -> line clears
Browse files Browse the repository at this point in the history
  • Loading branch information
Jahgii committed Oct 29, 2023
1 parent 05463df commit 8d4cc21
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Projects/Tetris/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,7 @@ void ResumeGame(ConsoleKey key = ConsoleKey.Enter)

void AddScoreChangeSpeed(int value)
{
if (value >= 4) value++;
Score += value;

FallSpeedMilliSeconds = Score switch
Expand Down Expand Up @@ -679,6 +680,7 @@ void TetrominoFall(object? e)
if (!collision) TETROMINO.Y = yAfterFall;

//Clean Lines
int clearedLines = 0;
for (var lineIndex = PLAYFIELD.Length - 1; lineIndex >= 0; lineIndex--)
{
string line = PLAYFIELD[lineIndex];
Expand All @@ -689,7 +691,7 @@ void TetrominoFall(object? e)
if (!notCompleted)
{
PLAYFIELD[lineIndex] = "│ │";
AddScoreChangeSpeed(1);
clearedLines++;

for (int lineM = lineIndex; lineM >= 1; lineM--)
{
Expand All @@ -706,6 +708,8 @@ void TetrominoFall(object? e)
}
}

AddScoreChangeSpeed(clearedLines / 2);

//VerifiedCollision
if (Collision(Direction.None) && FallTimer is not null) Gameover();
}
Expand Down

0 comments on commit 8d4cc21

Please sign in to comment.