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 William Minix

test

Revision:
27:9a17cf897bf8
Parent:
16:e4e6515bdabb
--- a/enemy.cpp	Wed Apr 28 03:12:39 2021 +0000
+++ b/enemy.cpp	Wed Apr 28 14:44:14 2021 +0000
@@ -1,16 +1,26 @@
 #include "enemy.h"
 #include "missile.h"
+#include "globals.h"
 
-void draw_enemy(int blk_x, int blk_y, int enemy_color, int e_width, int e_height)
+void draw_enemy(int blk_x, int blk_y, int enemy_color, int e_width, int e_height, enemy_t *g)
 {
-    uLCD.filled_rectangle(blk_x,blk_y,blk_x+e_width,blk_y-e_height,enemy_color);
+    char *shapes;
+    //enemy_color = 0x00FF00;
+    if (enemy_color == 0xFF0000){
+    shapes = "0000RRR00000RRRRRRRRR0RRRRRRRRRRRRRR00R00RRRRRRRRRRRRRR000RR0RR00000RR000RR00RR000R000RR";
+   }
+   // uLCD.filled_rectangle(blk_x,blk_y,blk_x+e_width,blk_y-e_height,enemy_color);
     //const int* colors = [
     //uLCD.BLIT(blk_x, blk_y, e_width, e_height, 
+    
+    
+    draw_img(blk_x, blk_y, e_width,  e_height, shapes); 
 }
 
 void erase_enemy(int blk_x, int blk_y, int enemy_color, int e_width, int e_height)
 {
-    uLCD.filled_rectangle(blk_x,blk_y,blk_x+e_width,blk_y-e_height,BACKGROUND_COLOR);
+    //uLCD.filled_rectangle(blk_x,blk_y,blk_x+e_width,blk_y-e_height,BACKGROUND_COLOR);
+     uLCD.filled_rectangle(blk_x - 2, blk_y, blk_x + 11 + 2, blk_y + 8 + 2,BACKGROUND_COLOR );
 }
 
 int move_enemy(enemy_t * g, int MOVE_DOWN, int DIRECTION)
@@ -53,15 +63,15 @@
 {
     g->enemy_blk_x = blk_x;
     g->enemy_blk_y = blk_y;
-    g->enemy_color = color;
-    g->enemy_width = 8;
+    g->enemy_color = 0xFF0000;
+    g->enemy_width = 11;
     g->enemy_height = 8;
     g->status = ENEMY_ALIVE;
 }
 
 void enemy_show(enemy_t * g)
 {
-    draw_enemy(g->enemy_blk_x, g->enemy_blk_y, g->enemy_color, g->enemy_width, g->enemy_height);
+    draw_enemy(g->enemy_blk_x, g->enemy_blk_y, g->enemy_color, g->enemy_width, g->enemy_height, g);
 }
 
 void enemy_erase(enemy_t * g)