Stick_Runner

Dependencies:   FXOS8700CQ Gamepad N5110 SDFileSystem mbed

Fork of Stick_Runner by Samrudh Sharma

Committer:
el15ss
Date:
Wed May 03 09:27:04 2017 +0000
Revision:
3:0c690f1c04d8
Parent:
1:db9ff66f67c8
Child:
4:2fdafb53eac2
Added DOxygen commenting to all files

Who changed what in which revision?

UserRevisionLine numberNew contents of line
el15ss 0:12cfe63faa6a 1 #ifndef Obstacles_H
el15ss 0:12cfe63faa6a 2 #define Obstacles_H
el15ss 0:12cfe63faa6a 3
el15ss 0:12cfe63faa6a 4 #include "mbed.h"
el15ss 0:12cfe63faa6a 5 #include "N5110.h"
el15ss 0:12cfe63faa6a 6 #include "Gamepad.h"
el15ss 3:0c690f1c04d8 7 /** Class Character
el15ss 3:0c690f1c04d8 8 @brief Class responsible for all the functionality of the obstacles including intialization, drawing, moving and updating it
el15ss 3:0c690f1c04d8 9 @author Samrudh Sharma
el15ss 3:0c690f1c04d8 10 @date
el15ss 3:0c690f1c04d8 11 */
el15ss 3:0c690f1c04d8 12
el15ss 3:0c690f1c04d8 13
el15ss 0:12cfe63faa6a 14
el15ss 0:12cfe63faa6a 15 class Obstacles
el15ss 0:12cfe63faa6a 16 {
el15ss 0:12cfe63faa6a 17 public:
el15ss 0:12cfe63faa6a 18
el15ss 3:0c690f1c04d8 19 /** Initialise display
el15ss 3:0c690f1c04d8 20 *
el15ss 3:0c690f1c04d8 21 * Powers up the display and turns on backlight (50% brightness default).
el15ss 3:0c690f1c04d8 22 * Intialises the charchter status, x and y co-ordinate of the obstacle.
el15ss 3:0c690f1c04d8 23 */
el15ss 0:12cfe63faa6a 24 void init();
el15ss 3:0c690f1c04d8 25
el15ss 3:0c690f1c04d8 26 /** Function to draw the obstacle
el15ss 3:0c690f1c04d8 27 *
el15ss 3:0c690f1c04d8 28 * Draws the obstacle to the display using the N5110 library and its object lcd.
el15ss 3:0c690f1c04d8 29 *
el15ss 3:0c690f1c04d8 30 */
el15ss 0:12cfe63faa6a 31 void draw(N5110 &lcd);
el15ss 3:0c690f1c04d8 32
el15ss 3:0c690f1c04d8 33 /** Updates/Moves Obstacle
el15ss 3:0c690f1c04d8 34 *
el15ss 3:0c690f1c04d8 35 * Helps the Obstacle move by updating its position on the screen by 1 pixel each time
el15ss 3:0c690f1c04d8 36 * therefore setting its speed aswell.
el15ss 3:0c690f1c04d8 37 */
el15ss 1:db9ff66f67c8 38 void updateObstacle();
el15ss 3:0c690f1c04d8 39
el15ss 3:0c690f1c04d8 40 /** Obstacle Status
el15ss 3:0c690f1c04d8 41 *
el15ss 3:0c690f1c04d8 42 * This fuction helps to check whether the obstacle has reached the bottom of the screen and updates the obstacle status
el15ss 3:0c690f1c04d8 43 * to false so that the obstacles can be generated again this creating a continuous flow of obstacles
el15ss 3:0c690f1c04d8 44 *
el15ss 3:0c690f1c04d8 45 * @param p - stores the 2D location i.e. the (x,y) co-ordinate of the cetre point of the obstacle on the screen .
el15ss 3:0c690f1c04d8 46 */
el15ss 1:db9ff66f67c8 47 void obstacleStatus(Vector2D p);
el15ss 3:0c690f1c04d8 48
el15ss 3:0c690f1c04d8 49 /** Obstacle Position
el15ss 3:0c690f1c04d8 50 *
el15ss 3:0c690f1c04d8 51 * Returns the 2D location i.e. the (x,y) co-ordinate of the cetre point of the obstacle on the screen .
el15ss 3:0c690f1c04d8 52 */
el15ss 1:db9ff66f67c8 53 Vector2D getObstaclePos();
el15ss 3:0c690f1c04d8 54
el15ss 3:0c690f1c04d8 55 /** Return Obstacle Status
el15ss 3:0c690f1c04d8 56 *
el15ss 3:0c690f1c04d8 57 * Returns the status of the obstacle which is sent to the main, where it is used to determine whether the obstacles have to be intialized or
el15ss 3:0c690f1c04d8 58 * or renderd again.
el15ss 3:0c690f1c04d8 59 */
el15ss 1:db9ff66f67c8 60 bool getObstacleStatus();
el15ss 0:12cfe63faa6a 61
el15ss 0:12cfe63faa6a 62 private:
el15ss 3:0c690f1c04d8 63
el15ss 3:0c690f1c04d8 64 //Variables
el15ss 3:0c690f1c04d8 65 int obsPosX; // X cocordinate of the obstacle
el15ss 3:0c690f1c04d8 66 int obsPosY; // Y cocordinate of the obstacle
el15ss 3:0c690f1c04d8 67 bool obStatus; //Variable to store the Obstacles status
el15ss 3:0c690f1c04d8 68
el15ss 0:12cfe63faa6a 69
el15ss 0:12cfe63faa6a 70 };
el15ss 0:12cfe63faa6a 71 #endif