Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

scoring now like NDS, also filled pieces on the sides #7

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 33 additions & 5 deletions Tetris.ino
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ bool holdPressed = false;
bool holdLocked = false;

int level;
int prevlines = 0;
int clearedLines;
unsigned long score;

Expand Down Expand Up @@ -87,21 +88,31 @@ void addScore(int numLines) {
int points;
switch(numLines) {
case 1:
points = 40 * level;
points = 100 * level;
break;
case 2:
points = 100 * level;
points = 300 * level;
break;
case 3:
points = 300 * level;
points = 500 * level;
break;
case 4:
points = 1200 * level;
points = 800 * level;
if (prevlines == 4)
{
points += 400 * level; // 3/2 like Tetris DS
drawBack2Back();
} else {
drawTetris();
}
break;
default:
points = 0;
}

if (numLines > 0)
{
prevlines = numLines;
}
score += points;
}

Expand Down Expand Up @@ -302,6 +313,23 @@ void manageGame() {
}
}

void drawTetris()
{
arduboy.setCursor(WIDTH / 2 - 16, HEIGHT / 2 - 5);
arduboy.print("Tetris!");
arduboy.display();
delay(dropDelay);
}


void drawBack2Back()
{
arduboy.setCursor(WIDTH / 2 - 16, HEIGHT / 2 - 5);
arduboy.print("Back to Back Tetris!");
arduboy.display();
delay(dropDelay);
}

void drawBackground() {
arduboy.drawBitmap(0, 0, background, WIDTH, HEIGHT, WHITE);
}
Expand Down