Skip to content

Commit

Permalink
Cleaned up comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kliao2016 committed Nov 13, 2017
1 parent 1bb4f6e commit b2451a9
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 18 deletions.
Binary file modified BrickBreaker.elf
Binary file not shown.
Binary file modified BrickBreaker.gba
Binary file not shown.
16 changes: 0 additions & 16 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,12 +110,6 @@ void ballMovement(Ball *ballptr, Slider *sldptr, Brick *brptr, int *numBricks, i
*/
void handleCollisions(Ball *ballptr, Slider *sldptr) {

// int seed = 0;
// while (!KEY_DOWN_NOW(BUTTON_RIGHT)) {
// seed++;
// }
// srand(seed);

if (ballptr->col < 0) {
ballptr->col = 0;
ballptr->xDir *= -1;
Expand Down Expand Up @@ -181,12 +175,6 @@ void generateBricks(Brick *brptr, int numBricks) {
*/
void handleBrickCollisions(Brick *brptr, Ball *ballptr, int *numBricks, int bricksSize) {

// int seed = 0;
// while (!KEY_DOWN_NOW(BUTTON_RIGHT)) {
// seed++;
// }
// srand(seed);

for (int i = 0; i < bricksSize; i++) {
Brick *cur = brptr + i;
if (cur->isHit) {
Expand All @@ -204,17 +192,13 @@ void handleBrickCollisions(Brick *brptr, Ball *ballptr, int *numBricks, int bric
*(numBricks) -= 1;
cur->isHit = 1;
ballptr->xDir *= -1;
//ballptr->xDir = ballptr->xDir * ((*(numBricks) % 2) + 1);
ballptr->col = ballptr->col + (ballptr->xDir * 1);
} else if ((((ballptr->row + BALLSIZE) == cur->row)
|| (ballptr->row == (cur->row + BRICKHEIGHT)))
&& ((ballptr->col >= (cur->col - BALLSIZE))
&& (ballptr->col <= (cur->col + BRICKWIDTH)))) {
*(numBricks) -= 1;
cur->isHit = 1;
ballptr->yDir *= -1;
//ballptr->yDir = ballptr->yDir * ((*(numBricks) % 2) + 1);
ballptr->row = ballptr->row + (ballptr->yDir * 1);
}
drawRect(cur->row, cur->col, BRICKHEIGHT, BRICKWIDTH, cur->color);
}
Expand Down
Binary file modified game.o
Binary file not shown.
4 changes: 2 additions & 2 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ Slider slider;
Slider *sldptr = &slider;
Ball ball;
Ball *ballptr = &ball;
Brick bricks[18];
Brick bricks[21];
Brick *brptr = bricks;
int numBricks;
int bricksSize;
int level = INITIAL_LEVEL;
int lives = INITIAL_LIVES;
char textBuffer[75];
char textBuffer[70];
int enterPressed = 0;
int zPressed = 0;
int backPressed = 0;
Expand Down
Binary file modified main.o
Binary file not shown.

0 comments on commit b2451a9

Please sign in to comment.