Stick_Runner
Dependencies: FXOS8700CQ Gamepad N5110 SDFileSystem mbed
Diff: Obstacles/Obstacles.h
- Revision:
- 3:0c690f1c04d8
- Parent:
- 1:db9ff66f67c8
- Child:
- 4:2fdafb53eac2
diff -r 98a41609c827 -r 0c690f1c04d8 Obstacles/Obstacles.h --- a/Obstacles/Obstacles.h Tue May 02 18:42:45 2017 +0000 +++ b/Obstacles/Obstacles.h Wed May 03 09:27:04 2017 +0000 @@ -4,26 +4,68 @@ #include "mbed.h" #include "N5110.h" #include "Gamepad.h" +/** Class Character +@brief Class responsible for all the functionality of the obstacles including intialization, drawing, moving and updating it +@author Samrudh Sharma +@date +*/ + + class Obstacles { public: -// Obstacles(); - // ~Obstacles(); +/** Initialise display +* +* Powers up the display and turns on backlight (50% brightness default). +* Intialises the charchter status, x and y co-ordinate of the obstacle. +*/ void init(); + + /** Function to draw the obstacle +* +* Draws the obstacle to the display using the N5110 library and its object lcd. +* +*/ void draw(N5110 &lcd); + +/** Updates/Moves Obstacle +* +* Helps the Obstacle move by updating its position on the screen by 1 pixel each time +* therefore setting its speed aswell. +*/ void updateObstacle(); + +/** Obstacle Status +* +* This fuction helps to check whether the obstacle has reached the bottom of the screen and updates the obstacle status +* to false so that the obstacles can be generated again this creating a continuous flow of obstacles +* +* @param p - stores the 2D location i.e. the (x,y) co-ordinate of the cetre point of the obstacle on the screen . +*/ void obstacleStatus(Vector2D p); - void add_score(); - int get_score(); + +/** Obstacle Position +* +* Returns the 2D location i.e. the (x,y) co-ordinate of the cetre point of the obstacle on the screen . +*/ Vector2D getObstaclePos(); + +/** Return Obstacle Status +* +* 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 +* or renderd again. +*/ bool getObstacleStatus(); private: - int obsPosX; - int obsPosY; -bool obStatus; + +//Variables + int obsPosX; // X cocordinate of the obstacle + int obsPosY; // Y cocordinate of the obstacle + bool obStatus; //Variable to store the Obstacles status + }; #endif \ No newline at end of file