Stick_Runner

Dependencies:   FXOS8700CQ Gamepad N5110 SDFileSystem mbed

Fork of Stick_Runner by Samrudh Sharma

Obstacles/Obstacles.cpp

Committer:
el15ss
Date:
2017-05-02
Revision:
2:98a41609c827
Parent:
1:db9ff66f67c8
Child:
3:0c690f1c04d8

File content as of revision 2:98a41609c827:



#include "Obstacles.h"


void Obstacles::init()
{
    obsPosX = rand() % 84;
    obsPosY = rand() % 42-42;
    obStatus = true;
}

void Obstacles::draw(N5110 &lcd)
{
   //lcd.drawRect(obsPosX-4,obsPosY-3,3,3,FILL_BLACK);
   //lcd.drawLine(obsPosX-3, obsPosY-3,obsPosX-3,obsPosY+1,1);
   
   //lcd.drawCircle(obsPosX,obsPosY,2,FILL_BLACK);
    lcd.setPixel(obsPosX,obsPosY);
    
       
   
   
   
}


void Obstacles::updateObstacle()
{
   obsPosY =obsPosY+1;
  
}

void Obstacles::obstacleStatus(Vector2D p)
{
   /* if(((p.x<obsPosX+3)&&(p.x>obsPosX-3))&&((p.y<obsPosY+3)&&(p.y>obsPosY-3))){
        
        obstacleStatus = false;
        }
     */   
        if(obsPosY > HEIGHT)
        {
            obStatus = false;
        }
}


Vector2D Obstacles::getObstaclePos()
{
    Vector2D p = {obsPosX,obsPosY};
    return p;    
}


bool Obstacles::getObstacleStatus()
{
    return obStatus;
    
    }