Updated Space Invaders on the mbed. Improved upon Michael Son's "Mbed Space Invaders" at https://os.mbed.com/users/michaeljson/notebook/mbed-space-invaders/.
Dependencies: mbed wave_player mbed-rtos 4DGL-uLCD-SE SparkfunAnalogJoystick SDFileSystem LSM9DS1_Library_cal_updated
Fork of Two-PlayerSpaceInvaders by
test
Diff: player.cpp
- Revision:
- 22:a907eeb128a4
- Parent:
- 21:a6b4c5598083
- Child:
- 23:56f6a12aaebd
diff -r a6b4c5598083 -r a907eeb128a4 player.cpp --- a/player.cpp Sun Apr 25 04:04:31 2021 +0000 +++ b/player.cpp Sun Apr 25 21:12:30 2021 +0000 @@ -6,6 +6,7 @@ #define PINK 0xFFC0CB #define PURPLE 0x800080 #define YELLOW 0xFFFF00 +#define RED 0xFF0000 // Modified from the RPG Game from ECE 2035. Draw more complex player object (with changing color). void draw_img(int u, int v, int width, int height, const char* img) { @@ -17,6 +18,7 @@ else if (img[i] == 'P') colors[i] = PINK; else if (img[i] == 'U') colors[i] = PURPLE; else if (img[i] == 'Y') colors[i] = YELLOW; + else if (img[i] == 'R') colors[i] = RED; else colors[i] = BLACK; } uLCD.BLIT(u, v, width, height, colors); @@ -35,6 +37,8 @@ colors = "000000P00000000000PPP0000000000PPP000000PPPPPPPPPPP0PPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPPP"; } else if (player_color == PURPLE) { colors = "000000U00000000000UUU0000000000UUU000000UUUUUUUUUUU0UUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUUU"; + } else if (player_color == RED) { + colors = "000000R00000000000RRR0000000000RRR000000RRRRRRRRRRR0RRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRRR"; } else { colors = "000000Y00000000000YYY0000000000YYY000000YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"; }