Skip to content

Commit

Permalink
Made collision detection a little more efficient
Browse files Browse the repository at this point in the history
  • Loading branch information
kliao2016 committed Nov 13, 2017
1 parent 52f5529 commit ad555e7
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 0 deletions.
Binary file modified BrickBreaker.elf
Binary file not shown.
Binary file modified BrickBreaker.gba
Binary file not shown.
5 changes: 5 additions & 0 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,11 @@ void handleBrickCollisions(Brick *brptr, Ball *ballptr, int *numBricks, int bric
Brick *cur = brptr + i;
if (cur->isHit) {
drawRect(cur->row, cur->col, BRICKHEIGHT, BRICKWIDTH, BGCOLOR);
for (int j = i; j < bricksSize - 1; j++) {
brptr[j] = brptr[j + 1];
}
bricksSize = *(numBricks);
i--;
} else {
if (((ballptr->col == (cur->col + BRICKWIDTH))
|| ((ballptr->col + BALLSIZE) == cur->col))
Expand Down
Binary file modified game.o
Binary file not shown.

0 comments on commit ad555e7

Please sign in to comment.