ELEC2645 (2018/19) / Mbed 2 deprecated el17arm

Dependencies:   mbed

Revision:
58:4a826093d9e9
Parent:
56:8c827d1cae3b
Child:
59:d82d49a7a4d4
--- a/Sprites/Sprites.h	Wed Apr 24 20:56:36 2019 +0000
+++ b/Sprites/Sprites.h	Tue May 07 00:30:46 2019 +0000
@@ -5,7 +5,7 @@
 #include "N5110.h"
 #include "Gamepad.h"
 
-/////////// All sprite bitmaps////////////////
+/////////// All sprite bitmaps ////////////////
 
 // right facing miner bitmap
 const int miner_right[24] =   {
@@ -80,33 +80,7 @@
         1,0,1,0,1,
 };
 
-/////////structs for sprite parameters and collision detection//////////////
-
-/** Keys position struct */
-
-struct Key_init {
-    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];  /**< 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 {
-    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 up to 6 levels//////////////////
+/////////////Structs for populating up to 6 levels//////////////////
 
 /** Enemy locations for each level struct */
 struct Enemies {
@@ -137,12 +111,8 @@
     double sy[5];   /**< sinking blocks y positions for each level */
     int sx2[5];     /**< sinking blocks x2 (length) positions for each level */
 };
-/** Exit location for each level struct */
-struct Level_exit {
-    double lx[5];   /**< Exit x position for each level */
-    double ly[5];   /**< Exit y position for each level */
-};
 
+///////////////////////////////////////////////////////////////////////////////
 
 /** Sprites Class
 @details Draws sprites and sets all collision rules 
@@ -203,7 +173,7 @@
     */
     void enemy_init(int i, int x, int y, int d);
     /** Updates enemy movement.
-    @paramindex, these will always be 0 - 2 so each enemy is treated individually.
+    @param index, these will always be 0 - 2 so each enemy is treated individually.
     @param velocity how many pixels enemies will move each loop.
     */
     void enemy_move(int i, double v, N5110 &lcd);
@@ -257,8 +227,8 @@
     */
     void soft_blocks(int x, int y, int z, N5110 &lcd);
     
-    Key_init _k;
-
+    bool _key[5]; /*initialise key flag, will only draw key if false, array identifies keys individually
+    made public has key_reinit() needs to reset flag at start of each level*/
 private:
 
     int _direction;
@@ -269,15 +239,19 @@
     bool _j_flag;
     int _j_counter;
     
-    bool block[5];
-    bool right_collision;
-    bool left_collision;
+    double _kx[5]; // key x position
+    double _ky[5]; // key y position
+    int _keys; // keeps count of how many keys collected
     
-    bool _collision;
-    int _keys;
+    bool _eflag[5];  // initialise enemy flag, array identifies each enemy 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 
     
-    Enemies_init _enem; 
-    Solid_blocks_init _b;
+    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 
        
 };
 #endif
\ No newline at end of file