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 5 commits
Commits
File filter

Filter by extension

Filter by extension

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

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

Expand Down Expand Up @@ -86,21 +87,29 @@ 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();
}
break;
default:
points = 0;
}

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

Expand Down Expand Up @@ -312,6 +321,14 @@ void manageGame() {
}
}

void drawBack2Back()
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a little too fast and a definitely too big (i.e. the text goes off the screen). Drawing or adding delays in the middle of the game manager also needs to be justified. Thinking about it, pausing should probably be moved out to its own function to be called in drawFrame().

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, I still would like on screen indication of the back to back tetris in some way that resembles this: https://www.youtube.com/watch?v=UlwH4v9_OvE

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same for regular tetris.
perhaps doing something with the background to signify this ?

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

void drawBackground() {
arduboy.drawBitmap(0, 0, background, WIDTH, HEIGHT, WHITE);
}
Expand All @@ -332,7 +349,7 @@ void drawPieceAt(Piece& piece, int x, int y) {
for(int i = 0; i < piece.width; ++i) {
for(int j = 0; j < piece.width; ++j) {
if(piece.shape[i][j] == 1) {
arduboy.drawRect(x + j * CELL_SIZE, y + i * CELL_SIZE, CELL_SIZE, CELL_SIZE, WHITE);
arduboy.fillRect(x + j * CELL_SIZE, y + i * CELL_SIZE, CELL_SIZE, CELL_SIZE, WHITE);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A matter of taste, I think. Having two different sprites bothers me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get it. though it does make it easier to look at the next piece and held piece.
this is in prep for ghost piece (a la TGM3)

Once ghost piece works, everything can become a solid.
I intend ghost piece to be a simple black rect (non filled).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually, i take that back, can't go solid, my bad

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also need to add efficiency meter (tetris/total lines)

}
}
}
Expand Down