Stick_Runner
Dependencies: FXOS8700CQ Gamepad N5110 SDFileSystem mbed
Diff: Obstacles/Obstacles.cpp
- Revision:
- 6:bf601a65cb27
- Parent:
- 4:2fdafb53eac2
--- a/Obstacles/Obstacles.cpp Thu May 04 09:50:18 2017 +0000 +++ b/Obstacles/Obstacles.cpp Thu May 04 13:04:14 2017 +0000 @@ -5,6 +5,7 @@ void Obstacles::init() { + //fprintf("in obstacle init"); //Initializing the X and Y co ordinates of the obstacle obsPosX = rand() % 84; obsPosY = rand() % 42-42; @@ -15,19 +16,19 @@ void Obstacles::draw(N5110 &lcd) { + //Drawing the character + //fprintf("Obstacle being drawn"); lcd.setPixel(obsPosX,obsPosY); - - - } //To move the obstacle void Obstacles::updateObstacle() { //Updating the position of the obstacle on the screen and setting its speed + //fprintf("updating th obstaclee to make it move"); obsPosY =obsPosY+1; } @@ -35,6 +36,8 @@ //Function to check if the obstacle has reached the end of the screen void Obstacles::obstacleStatus(Vector2D p) { + //fprintf("in obstacle status"); + //Update status if at end of the screen if(obsPosY > HEIGHT) { @@ -45,13 +48,21 @@ //Returns the postion (x,y) of the obstacle on the screen Vector2D Obstacles::getObstaclePos() { + //fprintf("in obstacle get pos"); + Vector2D p = {obsPosX,obsPosY}; + //fprintf("the value of p is %d", p); + return p; } //Returns the status of the obstacle bool Obstacles::getObstacleStatus() { + //fprintf("in get obstacle status"); + + //fprintf("The value of obstacle status is (in 0/1) %d",obStatus); + //Used to check when to initialise and render the obstacle return obStatus;