Stick_Runner

Dependencies:   FXOS8700CQ Gamepad N5110 SDFileSystem mbed

Revision:
1:db9ff66f67c8
Parent:
0:12cfe63faa6a
Child:
2:98a41609c827
--- a/Gems/Gems.cpp	Fri Apr 28 09:00:21 2017 +0000
+++ b/Gems/Gems.cpp	Fri Apr 28 16:30:47 2017 +0000
@@ -12,68 +12,70 @@
 
 void Gems::init()
 {
-    _x = rand() % 84;
-    _y = 0;
-    _status = true;
-    counter;
+    gemPosX = rand() % 84;
+    gemPosY = rand() % 42-42;
+    
+    gStatus = true;
+   
 }
 
 void Gems::draw(N5110 &lcd)
 {
     // draw Gemss in screen buffer. 
-   //lcd.drawRect(_x-4,_y-3,3,3,FILL_BLACK);
-   //lcd.drawLine(_x-3, _y-3,_x-3,_y+1,1);
+   //lcd.drawRect(gemPosX-4,gemPosY-3,3,3,FILL_BLACK);
+   //lcd.drawLine(gemPosX-3, gemPosY-3,gemPosX-3,gemPosY+1,1);
    
-   //lcd.drawCircle(_x,_y,2,FILL_BLACK);
-   lcd.setPixel(_x,_y);
-   lcd.setPixel(_x+1,_y);
-   lcd.setPixel(_x-1,_y);
-   lcd.setPixel(_x,_y+1);
-   lcd.setPixel(_x,_y-1);
+   //lcd.drawCircle(gemPosX,gemPosY,2,FILL_BLACK);
+   lcd.setPixel(gemPosX,gemPosY);
+   lcd.setPixel(gemPosX+1,gemPosY);
+   lcd.setPixel(gemPosX-1,gemPosY);
+   lcd.setPixel(gemPosX,gemPosY+1);
+   lcd.setPixel(gemPosX,gemPosY-1);
  
    
    
    
 }
 
-void Gems::Gems_Status(Vector2D p)
+void Gems::gemStatus(Vector2D p)
 {
-   /* if(((p.x<_x+3)&&(p.x>_x-3))&&((p.y<_y+3)&&(p.y>_y-3))){
+   if(((gemPosX>p.x-5)&&(gemPosX<p.x+5))&&(gemPosY>p.y))
+   {
+        //counter++;
+       gStatus = false;
+   }
+   
+  
+       
         
-        _status = false;
-        }
-     */   
-        if(_y > HEIGHT)
-        {
-            _status = false;
-        }
+   if(gemPosY > HEIGHT)
+   {
+            gStatus = false;
+   }
 }
 
-void Gems::Gems_Score(Vector2D p)
+int Gems::gemScore()
 {
-    if(((_x-1<p.x)&&(_x+1>p.x))&&((_y-1<p.y)&&(_y+1>p.y))){
-        
-        counter++;
-        }
+     //return counter;
 }
 
-void Gems::update()
+void Gems::updateGems()
 {
-   _y =_y+2;
-  /* if(!_status)
-   {
-       _y = HEIGHT + 3;
-       }*/
+   gemPosY =gemPosY+2;
+  
 }
 
 
 
-Vector2D Gems::get_pos() {
-    Vector2D p = {_x,_y};
+Vector2D Gems::getGemPos() 
+{
+    Vector2D p = {gemPosX,gemPosY};
     return p;    
 }
-bool Gems::get_status(){
-    return _status;
+
+bool Gems::getGemStatus()
+{
+    return gStatus;
     
     }