-
Notifications
You must be signed in to change notification settings - Fork 1
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
base: master
Are you sure you want to change the base?
Changes from 5 commits
b04a8a9
f2739c7
9c9e142
3118239
ea268e4
7539640
30d51ad
04e593e
6a5deb1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ bool holdPressed = false; | |
bool holdLocked = false; | ||
|
||
int level; | ||
int prevlines = 0; | ||
int clearedLines; | ||
unsigned long score; | ||
|
||
|
@@ -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; | ||
} | ||
|
||
|
@@ -312,6 +321,14 @@ void manageGame() { | |
} | ||
} | ||
|
||
void drawBack2Back() | ||
{ | ||
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); | ||
} | ||
|
@@ -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); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A matter of taste, I think. Having two different sprites bothers me. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. Once ghost piece works, everything can become a solid. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. actually, i take that back, can't go solid, my bad There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. also need to add efficiency meter (tetris/total lines) |
||
} | ||
} | ||
} | ||
|
There was a problem hiding this comment.
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().
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 ?