Kostadin Chakarov / Mbed 2 deprecated el17kec

Dependencies:   mbed

Committer:
kocemax
Date:
Tue Mar 26 09:16:35 2019 +0000
Revision:
5:12c179da4788
Child:
6:39bda45efeed
Made a struct to store centerpoints, from which I can generate the map by storing the x and y in a struct within a vector. Now need to introduce collision between bricks and ball.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
kocemax 5:12c179da4788 1 #include "Map.h"
kocemax 5:12c179da4788 2 #include <vector>
kocemax 5:12c179da4788 3 using namespace std;
kocemax 5:12c179da4788 4
kocemax 5:12c179da4788 5 Centerpoints center;
kocemax 5:12c179da4788 6 vector <Centerpoints> point;
kocemax 5:12c179da4788 7
kocemax 5:12c179da4788 8 // Constructor
kocemax 5:12c179da4788 9 Map::Map()
kocemax 5:12c179da4788 10 {
kocemax 5:12c179da4788 11 }
kocemax 5:12c179da4788 12
kocemax 5:12c179da4788 13 // Destructor
kocemax 5:12c179da4788 14 Map::~Map()
kocemax 5:12c179da4788 15 {
kocemax 5:12c179da4788 16
kocemax 5:12c179da4788 17 }
kocemax 5:12c179da4788 18
kocemax 5:12c179da4788 19 void Map::setCenterpoints()
kocemax 5:12c179da4788 20 {
kocemax 5:12c179da4788 21 center.y = -1;
kocemax 5:12c179da4788 22 for (int i = 0; i < 15; i++)
kocemax 5:12c179da4788 23 {
kocemax 5:12c179da4788 24 center.y = center.y + 2;
kocemax 5:12c179da4788 25 for (int j = 0; j < 14; j++)
kocemax 5:12c179da4788 26 {
kocemax 5:12c179da4788 27 center.x = j * 6 + 1;//1,7,13,19,25,31,37,43,49,55,61,67,73,79 and 5 to the right
kocemax 5:12c179da4788 28 point.push_back(center);
kocemax 5:12c179da4788 29 }
kocemax 5:12c179da4788 30 }
kocemax 5:12c179da4788 31 }
kocemax 5:12c179da4788 32
kocemax 5:12c179da4788 33 void Map::drawMap(N5110 &lcd)
kocemax 5:12c179da4788 34 {
kocemax 5:12c179da4788 35 vector<Centerpoints>::size_type end = point.size();
kocemax 5:12c179da4788 36 for (int i = 0; i < end; i++)
kocemax 5:12c179da4788 37 {
kocemax 5:12c179da4788 38 for (int j = 0; j < 5; j++)
kocemax 5:12c179da4788 39 {
kocemax 5:12c179da4788 40 lcd.setPixel(point[i].x+j,point[i].y,true);
kocemax 5:12c179da4788 41 }
kocemax 5:12c179da4788 42 }
kocemax 5:12c179da4788 43 }