diff --git a/carrot_game/bitmap.h b/carrot_game/bitmap.h index 142e63d..a438a8e 100644 --- a/carrot_game/bitmap.h +++ b/carrot_game/bitmap.h @@ -10,4 +10,8 @@ PROGMEM const unsigned char fish[]={ PROGMEM const unsigned char fish_reverse[] { 0x00, 0x00, 0x00, 0x04, 0x00, 0x06, 0xc0, 0x07, 0xe0, 0x07, 0xf8, 0x67, 0xec, 0x7f, 0xfe, 0x3f, 0xfc, 0x3f, 0xf8, 0x77, 0xf0, 0x67, 0xe0, 0x07, - 0x00, 0x0e, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00 }; \ No newline at end of file + 0x00, 0x0e, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00 }; + +PROGMEM const unsigned char heart[]{ + 0x1b,0x1b,0x1f,0x1f,0x0e +}; \ No newline at end of file diff --git a/carrot_game/carrot_game.ino b/carrot_game/carrot_game.ino index 7403c2d..68d1c24 100644 --- a/carrot_game/carrot_game.ino +++ b/carrot_game/carrot_game.ino @@ -107,7 +107,7 @@ void display_welcome_page() { void display_game() { u8g2.setFont(u8g2_font_4x6_tf); u8g2.drawStr(108, 50, "SCORE:"); - u8g2.drawStr(108, 30, "LIVES:"); + //u8g2.drawStr(108, 30, "LIVES:"); u8g2.drawStr(108, 10, "MAX:"); //draw score u8g2.setFont(u8g2_font_5x7_mf); @@ -116,8 +116,17 @@ void display_game() { u8g2.drawStr(110, 62, num_str); sprintf(num_str, "%03d", max_score); u8g2.drawStr(110, 20, num_str); - sprintf(num_str, "%03d", lives); - u8g2.drawStr(110, 40, num_str); + short y = 0; + short x = 0; + for(int i = 0; i < lives; i++){ + if (i % 3 == 0){ + y = y +1; + x = 0; + } + u8g2.drawXBMP(110 + 6 * x, 20 + 6 * y, 5, 5, heart); + x = x + 1; + } + //draw fishes for (int i = 0; i < 8; i++) { if(fishes[i][0] != NULL){ diff --git a/resources/heart.xbm b/resources/heart.xbm new file mode 100644 index 0000000..33eb525 --- /dev/null +++ b/resources/heart.xbm @@ -0,0 +1,4 @@ +#define _width 5 +#define _height 5 +static char _bits[] = { + 0x1b,0x1b,0x1f,0x1f,0x0e };