Skip to content

Commit

Permalink
Fixed some collisions
Browse files Browse the repository at this point in the history
  • Loading branch information
kliao2016 committed Nov 14, 2017
1 parent c9044f8 commit f23c573
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Binary file modified BrickBreaker.elf
Binary file not shown.
Binary file modified BrickBreaker.gba
Binary file not shown.
8 changes: 4 additions & 4 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,18 +125,18 @@ void ballMovement(Ball *ballptr, Slider *sldptr, Brick *brptr, int *numBricks, i
*/
void handleCollisions(Ball *ballptr, Slider *sldptr) {

if (ballptr->col < 0) {
if (ballptr->col <= 0) {
ballptr->col = 0;
ballptr->xDir *= -1;
}

if (ballptr->row < 0) {
if (ballptr->row <= 0) {
ballptr->row = 0;
ballptr->yDir *= -1;
}

if (ballptr->col + BALLSIZE > SCREENWIDTH) {
ballptr->col = SCREENWIDTH - BALLSIZE;
if (ballptr->col + BALLSIZE >= SCREENWIDTH) {
ballptr->col = SCREENWIDTH - BALLSIZE - 1;
ballptr->xDir *= -1;
}

Expand Down
Binary file modified game.o
Binary file not shown.

0 comments on commit f23c573

Please sign in to comment.