Stick_Runner
Dependencies: FXOS8700CQ Gamepad N5110 SDFileSystem mbed
Diff: Gems/Gems.cpp
- Revision:
- 6:bf601a65cb27
- Parent:
- 5:1bf7c83f86cc
--- a/Gems/Gems.cpp Thu May 04 09:50:18 2017 +0000 +++ b/Gems/Gems.cpp Thu May 04 13:04:14 2017 +0000 @@ -3,6 +3,8 @@ void Gems::init() { + //fprintf("in gem init"); + //Initializing the X and Y co ordinates of the character gemPosX = rand() % 84; gemPosY = rand() % 42-42; @@ -16,6 +18,7 @@ { //Drawing the gems + //fprintf("gem being drawn"); lcd.setPixel(gemPosX,gemPosY); lcd.setPixel(gemPosX+1,gemPosY); lcd.setPixel(gemPosX-1,gemPosY); @@ -34,6 +37,7 @@ void Gems::updateGems() { //Updating the position of the gem on the screen and setting its speed + //fprintf("updating th gem to make it move"); gemPosY =gemPosY+2; } @@ -41,6 +45,7 @@ void Gems::gemStatus(Vector2D p) { + //fprintf("in gem status"); //Loop to check if a gem has touched the character and update its staus to make it siappear from the screen if(((gemPosX>p.x-5)&&(gemPosX<p.x+5))&&(gemPosY>p.y)) { @@ -48,7 +53,7 @@ gStatus = false; } - + //fprintf("gem status vale after checking if consumed %d",gStatus ); //To check if the gem has reached the bottom of the screen so we can intialise and render again if(gemPosY > HEIGHT) @@ -62,6 +67,7 @@ Vector2D Gems::getGemPos() { + //fprintf("in gem get pos"); Vector2D p = {gemPosX,gemPosY}; return p; } @@ -69,6 +75,11 @@ //Returns the status of the obstacle bool Gems::getGemStatus() { + + //fprintf("in get gem status"); + + //fprintf("The value of gem status is (in 0/1) %d",gStatus); + //Used to check when to initialise and render the gem return gStatus; }