ELEC2645 (2018/19) / Mbed 2 deprecated el17arm

Dependencies:   mbed

Revision:
49:9bea7089b657
Parent:
45:bad704c546d4
Child:
50:65ba437510f8
--- a/Sprites/Sprites.h	Wed Apr 24 15:20:01 2019 +0000
+++ b/Sprites/Sprites.h	Wed Apr 24 16:45:47 2019 +0000
@@ -13,6 +13,7 @@
 
 /////////// All sprite bitmaps////////////////
 
+// right facing miner bitmap
 const int miner_right[24] =   {
         
         1,1,1,
@@ -25,8 +26,8 @@
         0,1,1,
 
     };
-
-    const int miner_left[24] =   {
+// left facing miner bitmap
+const int miner_left[24] =   {
         
         1,1,1,
         0,1,1,
@@ -37,7 +38,7 @@
         0,1,0,
         1,1,0,
     };
-
+// enemy bitmap
 const int enemy[15] =   {
         
         1,1,1,
@@ -46,35 +47,35 @@
         0,1,0,
         1,1,1,
     };
-    
+// key bitmap
 const int key[12] =   {
         
         1,1,0,0,
         1,0,1,1,
         1,1,0,1,
     };
-
+// blank bitmap to show key collected
 const int key_collected[12] =   {
         
         0,0,0,0,
         0,0,0,0,
         0,0,0,0,
     };
-    
+// trap bitmap
 const int spike[9] =   {
         
         1,0,1,
         0,1,0,
         1,0,1,
     };
-    
+// solid block bitmap
 const int solid_block[18] =   {
         
         1,1,1,1,1,1,
         1,0,1,1,0,1,
         1,1,1,1,1,1,
     };
-    
+// level exit bitmap
 const int door[30] = {
         
         1,1,1,1,1,
@@ -87,73 +88,81 @@
 
 /////////structs for sprite parameters and collision detection//////////////
 
+/** Keys position struct */
+
 struct keyed {
-    bool key[5];
-    double kx[5];
-    double ky[5];
+    bool key[5];  /**< initialise key flag array identifies each key individually */
+    double kx[5]; /**< key x position*/
+    double ky[5]; /**< key y position*/
 };
-
+/** Enemy position and movement struct */
 struct enemies_init {
-    bool eflag[5];
-    double ex[5];
-    double ey[5];
-    int counter[5];
-    int distance[5];
+    bool eflag[5];  /**< initialise enemy flag array identifies each key individually */
+    double ex[5];   /**< enemy x position */
+    double ey[5];   /**< enemy y position */
+    int counter[5]; /**< enemy counter, counts pixels moved */
+    int distance[5];/**< distance enemy will travel before turning round */
 };
-
+/** Solid blocks struct */
 struct Solid_blocks_init {
-    int block[5];
-    double bx[5];
-    double by[5];
-    bool collision[5];
+    double bx[5];   /**< block x position array identifies each block individually */
+    double by[5];   /**< block y position array */
+    bool collision[5]; /**< collision indicator for each individual block */
 
 };
-/////////////structs for populating levels//////////////////
-
+/////////////structs for populating up to 6 levels//////////////////
+/** Enemy location for each level */
 struct Enemies {
-    bool f[5];
-    double ex[5];
-    double ey[5];
-    int c[5];
-    int d[5];
-    double v[5];
+    double ex[5]; /**< enemy x positions for each level */
+    double ey[5]; /**< enemy y positions for each level */
+    int c[5];     /**< enemy counters for each level */
+    int d[5];     /**< enemy travel distances for each level */
+    double v[5];  /**< varies enemies velocity */
 };
 
 struct Traps {
-    double tx[5];
-    double ty[5];
+    double tx[5];   /**< traps x positions for each level */
+    double ty[5];   /**< traps y positions for each level */
 };
 
 struct Keys {
-    double kx[5];
-    double ky[5];
+    double kx[5];   /**< keys x positions for each level */
+    double ky[5];   /**< keys y positions for each level */
 };
 
 struct Solid_blocks {
-    double bx[5];
-    double by[5];
+    double bx[5];   /**< blocks x positions for each level */
+    double by[5];   /**< blocks y positions for each level */
 };
 
 struct Soft_blocks {
-    double sx1[5];
-    double sy[5];
-    int sx2[5];
+    double sx1[5];  /**< sinking blocks x1 positions for each level */
+    double sy[5];   /**< sinking blocks y positions for each level */
+    int sx2[5];     /**< sinking blocks x2 (length) positions for each level */
 };
 
 struct Level_exit {
-    double lx[5];
-    double ly[5];
+    double lx[5];   /**< Exit x position for each level */
+    double ly[5];   /**< Exit y position for each level */
 };
 
 class Sprites
 {
 
 public:
-    
+    /** constructor
+    */
     Sprites();
+ /** deconstructor
+ */ 
     ~Sprites();
+ /** gets x and y position of player
+ */
     Vector2D get_pos();
-    
+ /** States starting position of player
+ @param x position
+ @param y position
+ */
     void miner_init(int x, int y);
     void miner_move(Direction d, N5110 &lcd);
     void miner_draw(N5110 &lcd);
@@ -174,6 +183,7 @@
     void soft_blocks(int x, int y, int z, N5110 &lcd);
     
     bool exit_level(int x, int y, N5110 &lcd);
+    
     keyed _k;
     enemies_init _enem;