Skip to content

Commit

Permalink
Added more color options for bricks
Browse files Browse the repository at this point in the history
  • Loading branch information
kliao2016 committed Nov 13, 2017
1 parent 091a832 commit 1bb4f6e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions game.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,13 +150,13 @@ void handleCollisions(Ball *ballptr, Slider *sldptr) {
* @param numBricks the number of bricks on the screen
*/
void generateBricks(Brick *brptr, int numBricks) {
u16 colors[] = {RED, GREEN, BLUE, YELLOW, WHITE};
u16 colors[] = {RED, DKGRAY, GREEN, BLUE, MAGENTA, YELLOW, WHITE};
int numcolors = sizeof(colors)/sizeof(colors[0]);
int row = 25;
int col = 45;
for (int i = 0; i < numBricks; i++) {
Brick *cur = brptr + i;
u16 color = colors[i % numcolors];
u16 color = colors[rand() % numcolors];
cur->row = row;
cur->col = col;
cur->height = BRICKHEIGHT;
Expand Down
2 changes: 2 additions & 0 deletions myLib.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,11 @@ typedef unsigned short u16;
#define BG2_ENABLE (1<<10)
#define COLOR(r, g, b) ((r) | (g)<<5 | (b)<<10)
#define RED COLOR(31, 0, 0)
#define CYAN COLOR(0, 31, 31)
#define GREEN COLOR(0, 31, 0)
#define BLUE COLOR(0,0,31)
#define YELLOW COLOR(31,31,0)
#define MAGENTA COLOR(31, 0, 31)
#define WHITE COLOR(31,31,31)
#define BLACK 0
#define DKGRAY COLOR(15, 15, 15)
Expand Down

0 comments on commit 1bb4f6e

Please sign in to comment.