Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Revision:
7:cd3cafda3dd4
Parent:
6:39bda45efeed
Child:
8:9b77eea95088
--- a/Map/Map.h	Mon Apr 08 09:14:33 2019 +0000
+++ b/Map/Map.h	Wed Apr 10 09:18:25 2019 +0000
@@ -6,33 +6,65 @@
 #include "Gamepad.h"
 #include "PlayerControl.h"
 #include "Ball.h"
+//#include "PowerUp.h"
 #include <vector>
 
+
 /** Map Class
 @author Kostadin Chakarov, University of Leeds
-@brief Creates the map in the Breakout++ game 
-@date March 2019
-*/ 
-
+@brief Creates the map in the Breakout game
+@date April 2019
+*/
+//x and y coords, width, height
 struct Brick {
     int x, y, w, h;
 };
+//need to write above to able to use in level
+class Map;
+
+//this only contains the initBricks function as it stores the bricks in the level
+class Level
+{
+public:
+    virtual void initBricks(Map &map) {} //virtual because will be different for each level
+};
+
+class Level1 : public Level
+{
+public:
+    virtual void initBricks(Map &map);
+};
+
+class Level2 : public Level
+{
+public:
+    virtual void initBricks(Map &map);
+};
+
+
 
 class Map
 {
 private:
-    std::vector<Brick> bricks;
+    int currentLevel; //keeps track of the current level
+    std::vector<Level*> levels; //stores the levels in a vector
+    std::vector<Brick> bricks; //stores the bricks in a vector
+    //std::vector<PowerUp> powerUps;
 
 public:
-     Map();
+    Map();
     ~Map();
+
+    int getCurrentLevel() { return currentLevel; } //returns the current level
+    bool hasWon() { return currentLevel >= levels.size(); } //true if current level = number of levels
+
     void initBricks();
     void drawMap(N5110 &lcd);
-    void checkCollision(GameObject &obj);
-    void destroyMap(N5110 &lcd, Gamepad &pad, Ball &ball);
-    
-private:
-
+    void checkCollision(GameObject &obj); // checks if brick<->ball collided
+    void resolveCollision(const Brick &brick, GameObject &obj); //resolves the collision 
+    bool checkLevel(); //checks if we cleared the level and if we won
+    void reset(); //resets game
+    void addBrick(Brick& brick) { bricks.push_back(brick); } //adds the bricks to the vector
 
 };
 #endif
\ No newline at end of file