ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jkeo

Dependencies:   mbed

Revision:
39:5d4277548303
Parent:
37:90a0671d2ba7
Child:
42:816e444e660b
--- a/SpaceInvaderEngine/SpaceInvaderEngine.h	Mon May 25 15:25:14 2020 +0000
+++ b/SpaceInvaderEngine/SpaceInvaderEngine.h	Mon May 25 16:27:29 2020 +0000
@@ -11,33 +11,89 @@
 
 #define BORDER 2
 
+/** SpaceInvaderEngine Class
+@author Joshua Ohara, el18jkeo, 201291390
+@brief Main game engine: checks collsions between objects, updates objects, draws objects
+@date May 2020
+*/ 
+
 class SpaceInvaderEngine
 {
 
 public:
+    /**Constructor*/
     SpaceInvaderEngine();
+    
+    /**Destructor*/
     ~SpaceInvaderEngine();
+    
+    /**Initialises all objects in game and sets private variables to inputs*/
     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
+    
+    /**Read the gamepad inputs (buttons and joysticks) for use in functions*/
     void read_input(Gamepad &pad);                                              //read the gamepad input (buttons and joystick)
+    
+    /**Update all objects in game and check for relevant collisions*/
     void update(Gamepad &pad, N5110 &lcd, int counter, int level);              //update all objects 
+    
+    /**Draw all objects in game*/
     void render(N5110 &lcd);                                                    //draw all objects
+    
+    /**Check for collision between ship bullets and aliens*/
     void ship_bullet_alien_collision(Gamepad &pad, N5110 &lcd);                 //check for collision between the ship bullets and the aliens
+    
+    /**Check for collision between ship bullets and cover 1*/
     void ship_bullet_cover1_collision(Gamepad &pad, N5110 &lcd);                //check for collision between the ship bullets and cover 1
+    
+    /**Check for collision between ship bullets and cover 2*/
     void ship_bullet_cover2_collision(Gamepad &pad, N5110 &lcd);                //check for collision between the ship bullets and cover 2
+    
+    /**Check for collision between ship bullets and cover 3*/
     void ship_bullet_cover3_collision(Gamepad &pad, N5110 &lcd);                //check for collision between the ship bullets and cover 3
+    
+    /**Check for collision between alien bullets and player ship*/
     void alien_bullet_ship_collision(Gamepad &pad, N5110 &lcd);                 //check for collision between the alien bullets and the ship
+    
+    /**Check for collision between alien bullet and cover 3*/
     void alien_bullet_cover3_collision(Gamepad &pad, N5110 &lcd);               //check for collision between the alien bullets and cover 3
+    
+    /**Check for collision between alien bullet and cover 1*/
     void alien_bullet_cover1_collision(Gamepad &pad, N5110 &lcd);               //check for collision between the alien bullets and cover 1
+    
+    /**Check for collision between alien bullet and cover 2*/
     void alien_bullet_cover2_collision(Gamepad &pad, N5110 &lcd);               //check for collision between the alien bullets and cover 2
+    
+    /**Check for collision between aliens and ship*/
     void alien_ship_collision(Gamepad &pad, N5110 &lcd);                        //check for collision between the aliens and the ship
+    
+    /**Check for collision between aliens and cover 1*/
     void alien_cover1_collision(Gamepad &pad, N5110 &lcd);                      //check for collision between the aliens and cover 1
+    
+    /**Check for collision between aliens and cover 2*/
     void alien_cover2_collision(Gamepad &pad, N5110 &lcd);                      //check for collision between the aliens and cover 2
+    
+    /**Check for collision between aliens and cover 3*/
     void alien_cover3_collision(Gamepad &pad, N5110 &lcd);                      //check for collision between the aliens and cover 3
-    void ship_powerup_collision(Gamepad &pad, N5110 &lcd);
+    
+    /**Check for collision between player ship and powerup*/
+    void ship_powerup_collision(Gamepad &pad, N5110 &lcd);                      //check for collision between player ship and powerup
+    
+    
     //accessors and mutators//
-    void get_ship_pos();                                                        //return the position of ths ship
+    
+    /**Return the life value of the alien armada
+    *@return armada life (bool)
+    */
     bool get_armada_life();                                                     //return the life value of the alien armada
+    
+    /**Return the life value of the ship
+    *@return ship life (bool)
+    */
     bool get_ship_life();                                                       //return the life value of the ship
+    
+    /**Set the life/hit value to all remaining objects to true or false repsectively at end of level
+    *@param all life/hit value
+    */
     void kill_all();                                                            //set life value of all objects to 0
  
 private:
@@ -55,7 +111,7 @@
     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
-    bool _powerup;
+    bool _powerup;                                                              //ship powerup flag
     
     int _ship_x;                                                                //x position of ship
     int _ship_y;                                                                //y position of ship