Skip to content

Commit

Permalink
Speed cannot change
Browse files Browse the repository at this point in the history
  • Loading branch information
kliao2016 committed Nov 14, 2017
1 parent 3a2bb8e commit 3a36301
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 12 deletions.
Binary file modified BrickBreaker.elf
Binary file not shown.
Binary file modified BrickBreaker.gba
Binary file not shown.
17 changes: 5 additions & 12 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -144,19 +144,13 @@ void handleCollisions(Ball *ballptr, Slider *sldptr) {
ballptr->row = sldptr->row - BALLSIZE;
ballptr->yDir *= -1;
if (ballptr->xDir > 0 && sldptr->cdel > 0) {
ballptr->xDir += 1;
ballptr->xDir = 1;
} else if (ballptr->xDir < 0 && sldptr->cdel > 0) {
ballptr->xDir += 1;
if (ballptr->xDir == 0) {
ballptr->xDir = -1;
}
ballptr->xDir = 1;
} else if (ballptr->xDir > 0 && sldptr->cdel < 0) {
ballptr->xDir -= 1;
if (ballptr->xDir == 0) {
ballptr->xDir = 1;
}
ballptr->xDir = -1;
} else {
ballptr->xDir -= 1;
ballptr->xDir = -1;
}
}

Expand Down Expand Up @@ -208,6 +202,7 @@ void handleBrickCollisions(Brick *brptr, Ball *ballptr, int *numBricks, int bric
brptr[j] = brptr[j + 1];
}
bricksSize = *(numBricks);
i--;
} else {
if (((ballptr->col == (cur->col + BRICKWIDTH))
|| ((ballptr->col + BALLSIZE) == cur->col))
Expand All @@ -222,7 +217,6 @@ void handleBrickCollisions(Brick *brptr, Ball *ballptr, int *numBricks, int bric
}
ballptr->col += ballptr->xDir;
ballptr->row += ballptr->yDir;
i = 0;
} else if ((((ballptr->row + BALLSIZE) == cur->row)
|| (ballptr->row == (cur->row + BRICKHEIGHT)))
&& ((ballptr->col >= (cur->col - BALLSIZE))
Expand All @@ -236,7 +230,6 @@ void handleBrickCollisions(Brick *brptr, Ball *ballptr, int *numBricks, int bric
}
ballptr->row += ballptr->yDir;
ballptr->col += ballptr->xDir;
i = 0;
}
drawRect(cur->row, cur->col, BRICKHEIGHT, BRICKWIDTH, cur->color);
}
Expand Down
Binary file modified game.o
Binary file not shown.
Binary file modified main.o
Binary file not shown.

0 comments on commit 3a36301

Please sign in to comment.