Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
Revision 13:fd290d2fd917, committed 2020-05-26
- Comitter:
- ll17lrc
- Date:
- Tue May 26 22:41:23 2020 +0000
- Parent:
- 12:299479b6bb59
- Commit message:
- Final Submission. I have read and agreed with Statement of Academic Integrity.
Changed in this revision
--- a/Ball/Ball.cpp Tue May 26 18:16:31 2020 +0000 +++ b/Ball/Ball.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,7 +10,7 @@ } - +//Initialises the ball sprite and the initial co-ords of the ball void Ball::init(int x,int y) { int ball[2][2] = { @@ -22,12 +22,15 @@ } - +//Takes x and y co-ordinates and draws the ball at that position. void Ball::draw(N5110 &lcd) { lcd.drawSprite(ball_x_pos,ball_y_pos,2,2,(int *)ball); } +//Takes the inputs of the gamepad and updates the x and y co-ords based on the +//direction of the joystick and whether button A has been pressed. +//Pressing A double the speed of the ball. void Ball::update(Direction d,Gamepad &pad) { @@ -87,6 +90,7 @@ } +//Functions to return the x and y co-ords of the ball int Ball::get_ball_x_pos(){ return ball_x_pos; } @@ -95,6 +99,7 @@ return ball_y_pos; } +//When a level has been completed, resets the balls co-ords void Ball::level_finish(){ ball_x_pos = 0; ball_y_pos = 21;
--- a/Ball/Ball.h Tue May 26 18:16:31 2020 +0000 +++ b/Ball/Ball.h Tue May 26 22:41:23 2020 +0000 @@ -6,28 +6,57 @@ #include "Gamepad.h" /** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +@author Lewis Cheadle +@brief Controls the ball in the Impossible game +@date May 2020 */ class Ball { public: + + /** Constructor */ Ball(); + + /** Destructor */ ~Ball(); + + /** Initialises the ball + * @param x initial X position of ball + * @param y initial Y position of ball + */ void init(int x,int y); + + /** Draws the ball + * @param lcd N5110 object + */ void draw(N5110 &lcd); + + /** Updates position of the ball + * @param d Direction of the joystick + * @param pad object + */ void update(Direction d,Gamepad &pad); + + /** Resets ball position of level is complete + */ void level_finish(); + + /** Returns ball X co-ordinate + */ int get_ball_x_pos(); + + /** Returns ball Y co-ordinate + */ int get_ball_y_pos(); - /// accessors and mutators private: + /* sprite to store ball drawing */ int ball; + /* Stores ball X co-ordinate */ int ball_x_pos; + /* Stores ball Y co-ordinate */ int ball_y_pos; };
--- a/Five/Five.cpp Tue May 26 18:16:31 2020 +0000 +++ b/Five/Five.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,13 +10,15 @@ } -int one; -int two; -int three; -int four; -int five; -int six; +//Initialising counters for the objects in the map +int object_one; +int object_two; +int object_three; +int object_four; +int object_five; +int object_six; +//Sprite that stores the path layout of the map int level_five[48][84] { { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, @@ -68,62 +70,65 @@ { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, }; +//Draws the sprite containing the path and all of the objects and obstacles +//on the map using seperate counters for seperate objects that were initialised +//above void Five::draw(N5110 &lcd) { lcd.drawSprite(0,0,48,84,(int *)level_five); - if(one < 15){ - lcd.drawRect(one + 18,11,2,7,FILL_BLACK); - one++; + if(object_one < 15){ + lcd.drawRect(object_one + 18,11,2,7,FILL_BLACK); + object_one++; } - if(one == 15){ - one = 0; + if(object_one == 15){ + object_one = 0; } - if(two < 12){ - two++; + if(object_two < 12){ + object_two++; lcd.drawRect(33,27,5,7,FILL_BLACK); } - if(12 <= two < 24){ - two++; + if(12 <= object_two < 24){ + object_two++; } - if(two == 24){ - two = 0; + if(object_two == 24){ + object_two = 0; } - if(three < 19){ - three++; - lcd.drawRect(48,19-three,6,2,FILL_BLACK); + if(object_three < 19){ + object_three++; + lcd.drawRect(48,19-object_three,6,2,FILL_BLACK); } - if(three == 19){ - three = 0; + if(object_three == 19){ + object_three = 0; } - if(four < 12){ - four++; + if(object_four < 12){ + object_four++; lcd.drawRect(58,2,4,12,FILL_BLACK); } - if(12 <= four < 36){ - four++; + if(12 <= object_four < 36){ + object_four++; } - if(four == 36){ - four = 0; + if(object_four == 36){ + object_four = 0; } - if(five < 12){ - lcd.drawCircle(52,45,five,FILL_TRANSPARENT); - five++; + if(object_five < 12){ + lcd.drawCircle(52,45,object_five,FILL_TRANSPARENT); + object_five++; } - if(five == 12){ - five = 0; + if(object_five == 12){ + object_five = 0; } - if(six < 6){ - lcd.drawCircle(65,30,six,FILL_TRANSPARENT); - six++; + if(object_six < 6){ + lcd.drawCircle(65,30,object_six,FILL_TRANSPARENT); + object_six++; } - if(six == 6){ - six = 0; + if(object_six == 6){ + object_six = 0; } } \ No newline at end of file
--- a/Five/Five.h Tue May 26 18:16:31 2020 +0000 +++ b/Five/Five.h Tue May 26 22:41:23 2020 +0000 @@ -6,17 +6,25 @@ #include "Gamepad.h" -/** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +/** Level Five Class +@author Lewis Cheadle +@brief Draws the maps and the objects in the level +@date May 2020 */ class Five { public: + + /** Constructor */ Five(); + + /** Destructor */ ~Five(); + + /** Draws the map and objects within the level + * @param lcd N5110 object + */ void draw(N5110 &lcd); /// accessors and mutators
--- a/Four/Four.cpp Tue May 26 18:16:31 2020 +0000 +++ b/Four/Four.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,8 +10,10 @@ } +//Initialising counters for the objects in the map int pos; +//Sprite that stores the path layout of the map int level_four[48][84] { { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, @@ -63,6 +65,9 @@ { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, }; +//Draws the sprite containing the path and all of the objects and obstacles +//on the map using seperate counters for seperate objects that were initialised +//above void Four::draw(N5110 &lcd){ lcd.drawSprite(0,0,48,84,(int *)level_four);
--- a/Four/Four.h Tue May 26 18:16:31 2020 +0000 +++ b/Four/Four.h Tue May 26 22:41:23 2020 +0000 @@ -6,17 +6,25 @@ #include "Gamepad.h" -/** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +/** Level Four Class +@author Lewis Cheadle +@brief Draws the maps and the objects in the level +@date May 2020 */ class Four { public: + + /** Constructor */ Four(); + + /** Destructor */ ~Four(); + + /** Draws the map and objects within the level + * @param lcd N5110 object + */ void draw(N5110 &lcd); /// accessors and mutators
--- a/Imposs/ImpossEngine.cpp Tue May 26 18:16:31 2020 +0000 +++ b/Imposs/ImpossEngine.cpp Tue May 26 22:41:23 2020 +0000 @@ -13,6 +13,7 @@ StartMenu _start; +//displays the start menu, initialises the ball and sets to level zero void ImpossEngine::complete(Gamepad &pad,N5110 &lcd) { level = 0; @@ -22,12 +23,20 @@ _ball.init(x,y); } +//reads user input from the gamepad void ImpossEngine::read_input(Gamepad &pad) { _d = pad.get_direction(); _mag = pad.get_mag(); } +//Used to set the level to zero +void ImpossEngine::set_level_zero() +{ + level = 0; +} + +//Draws the levels, obstacles and ball void ImpossEngine::draw(N5110 &lcd,Gamepad &pad) { // draw the elements in the LCD buffer @@ -80,34 +89,17 @@ } +//Updates all parameters, checks for collisions and checks to see if the level +//has been completed void ImpossEngine::update(Gamepad &pad,N5110 &lcd) { check_collision(pad,lcd); check_finish(pad); -} +} -void ImpossEngine::set_level_zero(){ - level = 0; - } - -void ImpossEngine::set_level_one(){ - level = 1; - } - -void ImpossEngine::set_level_two(){ - level = 2; - } - -void ImpossEngine::set_level_three(){ - level = 3; - } - -void ImpossEngine::set_level_four(){ - level = 4; - } - - +//Checks every pixel around the ball, if any are "on"(1) then that is classed +//as a collision void ImpossEngine::check_collision(Gamepad &pad,N5110 &lcd) { int _x = 0; @@ -170,6 +162,7 @@ _y --; + //death sequence if(collision == true){ lcd.clear(); lcd.printString(" You died! ",0,2); @@ -183,11 +176,15 @@ wait(0.2); pad.leds_off(); + //resets ball to start of level if a collision has been detected _ball.level_finish(); } } } +//Checks to see if the ball has reached the end of the level, if it has, +//increases the value of the level and sets the ball back to the beginning of +//the level void ImpossEngine::check_finish(Gamepad &pad) { @@ -197,12 +194,4 @@ level++; _ball.level_finish(); } - - if(pad.Y_pressed() == true){ - level++; - } - if(pad.X_pressed() == true){ - level--; - } - }
--- a/Imposs/ImpossEngine.h Tue May 26 18:16:31 2020 +0000 +++ b/Imposs/ImpossEngine.h Tue May 26 22:41:23 2020 +0000 @@ -20,41 +20,84 @@ { public: + + /** Constructor */ ImpossEngine(); + + /** Destructor */ ~ImpossEngine(); + /** Gets user input via the gamepad + * @param pad Gamepad object + */ void read_input(Gamepad &pad); + + /** Updates all of the values for the ball and maps + * @param pad Gamepad object + * @param lcd N5110 object + */ void update(Gamepad &pad,N5110 &lcd); + + /** Draws the level, ball and objects in the levels + * @param pad Gamepad object + * @param lcd N5110 object + */ void draw(N5110 &lcd,Gamepad &pad); + + /** Goes to the start menu, also initialises the ball + * @param pad Gamepad object + * @param lcd N5110 object + */ void complete(Gamepad &pad,N5110 &lcd); + + /** Sets the level to zero + */ void set_level_zero(); - void set_level_one(); - void set_level_two(); - void set_level_three(); - void set_level_four(); + + /** Stores the value of the level + */ int level; private: + /** Checks for a collision between the ball and a wall/object + * @param pad Gamepad object + * @param lcd N5110 object + */ void check_collision(Gamepad &pad, N5110 &lcd); + + /** Checks if the level has been completed + * @param pad Gamepad object + * @param lcd N5110 object + */ void check_finish(Gamepad &pad); - Ball _ball; - One _one; - Zero _zero; - Two _two; - Three _three; - Four _four; - Five _five; + Ball _ball; //Ball function call + One _one; //Level Zero function call + Zero _zero; //Level One function call + Two _two; // Level Two function call + Three _three; // Level Three function call + Four _four; // Level Four function call + Five _five; // Level Five function call + + /* Stores the x position of the ball */ + int x_pos; - int x_pos; + /* Stores the y postition of the ball */ int y_pos; + + /* Used as a counter to check if a collision has occured */ int x; + + /* Used as a counter to check if a collision has occured */ int y; + + /* Used to store the value returned when fetching the x co-ordinate of the + balle */ int pos; - Direction _d; - float _mag; + Direction _d; //Direction function call + float _mag; //Magnitude function call };
--- a/One/One.cpp Tue May 26 18:16:31 2020 +0000 +++ b/One/One.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,6 +10,7 @@ } +//Sprite that stores the path layout of the map int level_one[48][84] { { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, @@ -61,6 +62,7 @@ { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, }; +//Draws the map path void One::draw(N5110 &lcd){ lcd.drawSprite(0,0,48,84,(int *)level_one); } \ No newline at end of file
--- a/One/One.h Tue May 26 18:16:31 2020 +0000 +++ b/One/One.h Tue May 26 22:41:23 2020 +0000 @@ -6,17 +6,25 @@ #include "Gamepad.h" -/** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +/** Level One Class +@author Lewis Cheadle +@brief Draws the maps and the objects in the level +@date May 2020 */ class One { public: + + /** Constructor */ One(); + + /** Destructor */ ~One(); + + /** Draws the map and objects within the level + * @param lcd N5110 object + */ void draw(N5110 &lcd); /// accessors and mutators
--- a/StartMenu/StartMenu.cpp Tue May 26 18:16:31 2020 +0000 +++ b/StartMenu/StartMenu.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,13 +10,16 @@ } +//start menu void StartMenu::complete(Gamepad &pad,N5110 &lcd) { ImpossEngine imposs; + //stores position of the pointer int selector = 1; + //sprite to store the arrow used as an indicator on the menu int arrow[7][5] = { {0,0,0,0,0}, {1,1,0,0,0}, @@ -27,8 +30,10 @@ {0,0,0,0,0}, }; + //displays start menu until A is pressed while( pad.A_pressed() == false ){ + //draws the start menu lcd.clear(); lcd.printString(" IMPOSSIBLE ",0,1); lcd.printString(" Start Game ",0,3); @@ -38,20 +43,26 @@ wait(0.15); + //updates the position of the indicator if( pad.get_direction() == S ){ if( selector < 2 ){ selector ++; } } + //updates the position of the indicator if( pad.get_direction() == N ){ if( selector > 1 ){ selector --; } } } + + //starts the game if( selector == 1 ){ - imposs.set_level_one(); + imposs.set_level_zero(); } + + //explains how the game works, each screen is displayed until A is pressed if( selector == 2 ){ wait(0.15); while(pad.A_pressed() == false){ @@ -82,6 +93,7 @@ lcd.drawSprite(70,40,7,5,(int *)arrow); lcd.refresh(); } + //Starts the game after each screen has been displayed imposs.set_level_zero(); }
--- a/StartMenu/StartMenu.h Tue May 26 18:16:31 2020 +0000 +++ b/StartMenu/StartMenu.h Tue May 26 22:41:23 2020 +0000 @@ -6,24 +6,35 @@ #include "Gamepad.h" #include "ImpossEngine.h" -/** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +/** Start Menu Class +@author Lewis Cheadle +@brief Displays Start menu +@date May 2020 */ class StartMenu { public: + + /* Constructor **/ StartMenu(); + + /* Destructor **/ ~StartMenu(); + + /** Draws the start menu and allows user to select what to do + * @param lcd N5110 object + */ void complete(Gamepad &pad,N5110 &lcd); - /// accessors and mutators private: - + + /* Stores the value of the option that the user chooses */ int selector; + + /* Stores the sprite of the pointer so the user knows which option is + selected */ int arrow; };
--- a/Three/Three.cpp Tue May 26 18:16:31 2020 +0000 +++ b/Three/Three.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,8 +10,10 @@ } +//Initialising counters for the objects in the map int obs; +//Sprite that stores the path layout of the map int level_three[48][84] { { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, @@ -63,6 +65,9 @@ { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, }; +//Draws the sprite containing the path and all of the objects and obstacles +//on the map using seperate counters for seperate objects that were initialised +//above void Three::draw(N5110 &lcd){ lcd.drawSprite(0,0,48,84,(int *)level_three);
--- a/Three/Three.h Tue May 26 18:16:31 2020 +0000 +++ b/Three/Three.h Tue May 26 22:41:23 2020 +0000 @@ -6,17 +6,25 @@ #include "Gamepad.h" -/** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +/** Level Three Class +@author Lewis Cheadle +@brief Draws the maps and the objects in the level +@date May 2020 */ class Three { public: + + /** Constructor */ Three(); + + /** Destructor */ ~Three(); + + /** Draws the map and objects within the level + * @param lcd N5110 object + */ void draw(N5110 &lcd); /// accessors and mutators
--- a/Two/Two.cpp Tue May 26 18:16:31 2020 +0000 +++ b/Two/Two.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,6 +10,7 @@ } +//Sprite that stores the path layout of the map int level_two[48][84] { { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, @@ -61,6 +62,7 @@ { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, }; +//Draws the map path void Two::draw(N5110 &lcd) { lcd.drawSprite(0,0,48,84,(int *)level_two);
--- a/Two/Two.h Tue May 26 18:16:31 2020 +0000 +++ b/Two/Two.h Tue May 26 22:41:23 2020 +0000 @@ -6,17 +6,25 @@ #include "Gamepad.h" -/** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +/** Level Two Class +@author Lewis Cheadle +@brief Draws the maps and the objects in the level +@date May 2020 */ class Two { public: + + /** Constructor */ Two(); + + /** Destructor */ ~Two(); + + /** Draws the map and objects within the level + * @param lcd N5110 object + */ void draw(N5110 &lcd); /// accessors and mutators
--- a/Zero/Zero.cpp Tue May 26 18:16:31 2020 +0000 +++ b/Zero/Zero.cpp Tue May 26 22:41:23 2020 +0000 @@ -10,6 +10,7 @@ } +//Sprite that stores the path layout of the map int level_zero[48][84] { { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, @@ -61,6 +62,7 @@ { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, }; +//Draws the map path void Zero::draw(N5110 &lcd) { lcd.drawSprite(0,0,48,84,(int *)level_zero);
--- a/Zero/Zero.h Tue May 26 18:16:31 2020 +0000 +++ b/Zero/Zero.h Tue May 26 22:41:23 2020 +0000 @@ -6,19 +6,25 @@ #include "Gamepad.h" -/** Ball Class -@author Dr Craig A. Evans, University of Leeds -@brief Controls the ball in the Pong game -@date Febraury 2017 +/** Level Zero Class +@author Lewis Cheadle +@brief Draws the maps and the objects in the level +@date May 2020 */ class Zero { public: + /** Constructor */ Zero(); + + /** Destructor */ ~Zero(); + + /** Draws the map and objects within the level + * @param lcd N5110 object + */ void draw(N5110 &lcd); - /// accessors and mutators private:
--- a/main.cpp Tue May 26 18:16:31 2020 +0000 +++ b/main.cpp Tue May 26 22:41:23 2020 +0000 @@ -30,11 +30,6 @@ int main() { -//#ifdef WITH_TESTING -// int number_of_failures = run_all_tests(); -// -// if(number_of_failures > 0) return number_of_failures; -//#endif int fps = 6; // frames per second