ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jkeo

Dependencies:   mbed

Revision:
33:d8284dee58db
Parent:
24:ff5af5a013b5
Child:
35:517b56b010df
--- a/SpaceInvaderEngine/SpaceInvaderEngine.h	Mon May 18 08:43:15 2020 +0000
+++ b/SpaceInvaderEngine/SpaceInvaderEngine.h	Mon May 18 14:57:30 2020 +0000
@@ -17,57 +17,55 @@
 public:
     SpaceInvaderEngine();
     ~SpaceInvaderEngine();
-    void init(int ship_height, int ship_width, int alien_size, int no_aliens, int armada_column_size, int armada_row_size, int cover_y, int cover1_x, int cover2_x, int cover3_x, int no_rocks, int level);
-    void read_input(Gamepad &pad);
-    void update(Gamepad &pad, N5110 &lcd, int counter, int level);
-    void render(N5110 &lcd);
-    void shoot_bullet();
-    void get_ship_pos();
-    void ship_bullet_alien_collision(Gamepad &pad, N5110 &lcd);
-    void ship_bullet_cover1_collision(Gamepad &pad, N5110 &lcd);
-    void ship_bullet_cover2_collision(Gamepad &pad, N5110 &lcd);
-    void ship_bullet_cover3_collision(Gamepad &pad, N5110 &lcd);
-    void alien_bullet_ship_collision(Gamepad &pad, N5110 &lcd);
-    void alien_bullet_cover3_collision(Gamepad &pad, N5110 &lcd);
-    void alien_bullet_cover1_collision(Gamepad &pad, N5110 &lcd); 
-    void alien_bullet_cover2_collision(Gamepad &pad, N5110 &lcd);
-    void alien_ship_collision(Gamepad &pad, N5110 &lcd);
-    void alien_cover1_collision(Gamepad &pad, N5110 &lcd);
-    void alien_cover2_collision(Gamepad &pad, N5110 &lcd);
-    void alien_cover3_collision(Gamepad &pad, N5110 &lcd);
-    bool get_armada_life();
-    bool get_ship_life();
-    void kill_all();
+    void init(int ship_height, int ship_width, int alien_size, int no_aliens, int armada_column_size, int armada_row_size, int cover_y, int cover1_x, int cover2_x, int cover3_x, int no_rocks, int level); //initialise all needed objects and set private member variables
+    void read_input(Gamepad &pad);                                              //read the gamepad input (buttons and joystick)
+    void update(Gamepad &pad, N5110 &lcd, int counter, int level);              //update all objects 
+    void render(N5110 &lcd);                                                    //draw all objects
+    void ship_bullet_alien_collision(Gamepad &pad, N5110 &lcd);                 //check for collision between the ship bullets and the aliens
+    void ship_bullet_cover1_collision(Gamepad &pad, N5110 &lcd);                //check for collision between the ship bullets and cover 1
+    void ship_bullet_cover2_collision(Gamepad &pad, N5110 &lcd);                //check for collision between the ship bullets and cover 2
+    void ship_bullet_cover3_collision(Gamepad &pad, N5110 &lcd);                //check for collision between the ship bullets and cover 3
+    void alien_bullet_ship_collision(Gamepad &pad, N5110 &lcd);                 //check for collision between the alien bullets and the ship
+    void alien_bullet_cover3_collision(Gamepad &pad, N5110 &lcd);               //check for collision between the alien bullets and cover 3
+    void alien_bullet_cover1_collision(Gamepad &pad, N5110 &lcd);               //check for collision between the alien bullets and cover 1
+    void alien_bullet_cover2_collision(Gamepad &pad, N5110 &lcd);               //check for collision between the alien bullets and cover 2
+    void alien_ship_collision(Gamepad &pad, N5110 &lcd);                        //check for collision between the aliens and the ship
+    void alien_cover1_collision(Gamepad &pad, N5110 &lcd);                      //check for collision between the aliens and cover 1
+    void alien_cover2_collision(Gamepad &pad, N5110 &lcd);                      //check for collision between the aliens and cover 2
+    void alien_cover3_collision(Gamepad &pad, N5110 &lcd);                      //check for collision between the aliens and cover 3
+    //accessors and mutators//
+    void get_ship_pos();                                                        //return the position of ths ship
+    bool get_armada_life();                                                     //return the life value of the alien armada
+    bool get_ship_life();                                                       //return the life value of the ship
+    void kill_all();                                                            //set life value of all objects to 0
  
 private:
 
-    Armada A1;
-    Ship S1;
-    BulletS BS1;
-    Cover C1;
-    Cover C2;
-    Cover C3;
-    
-    int S1_height;
-    int S1_width;
-    int A1_size;
-    int N;
-    int CS;
-    int RS;
+    Armada _armada;                                                             //armada (vector of aliens) object
+    Ship _ship;                                                                 //ship object
+    BulletS _ship_bullets;                                                      //ship bullet vector
+    Cover _cover_1;                                                             //cover object (vector of rocks)
+    Cover _cover_2;                                                             //cover object (vector of rocks)
+    Cover _cover_3;                                                             //cover object (vector of rocks)
     
-    int A1y;
-    int S1x;
-    int S1y;
-    int Cy;
-    int C1x;
-    int C2x;
-    int C3x;
-    int NR;
+    int _ship_height;                                                           //height of ship
+    int _ship_width;                                                            //width of ship
+    int _alien_size;                                                            //size of alien
+    int _alien_number;                                                          //number of aliens
+    int _armada_column_size;                                                    //number of of aliens per column of armada
+    int _armada_row_size;                                                       //number of aliens per row of armada
     
+    int _ship_x;                                                                //x position of ship
+    int _ship_y;                                                                //y position of ship
+    int _cover_y;                                                               //y position of covers
+    int _cover_1_x;                                                             //x position of cover 1
+    int _cover_2_x;                                                             //x position of cover 2
+    int _cover_3_x;                                                             //x position of cover 3
+    int _rock_number;                                                           //number of rocks per cover
+        
     
-    Direction D;
-    float Mag;
-    
+    Direction D;                                                                //direction of joystick
+    float _mag;                                                                 //magnitude of joystick offset
 };
 
 #endif
\ No newline at end of file