Stick_Runner

Dependencies:   FXOS8700CQ Gamepad N5110 SDFileSystem mbed

Fork of Stick_Runner by Samrudh Sharma

Obstacles/Obstacles.cpp

Committer:
el15ss
Date:
2017-04-28
Revision:
0:12cfe63faa6a
Child:
1:db9ff66f67c8

File content as of revision 0:12cfe63faa6a:



#include "Obstacles.h"

Obstacles::Obstacles()
{

}

Obstacles::~Obstacles()
{

}

void Obstacles::init()
{
    _x = rand() % 84;
    _y = rand() % 42-42;
    _status = true;
}

void Obstacles::draw(N5110 &lcd)
{
    // draw Obstacless 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.drawCircle(_x,_y,2,FILL_BLACK);
    lcd.setPixel(_x,_y);
 
   
   
   
}

void Obstacles::Obstacles_Status(Vector2D p)
{
   /* if(((p.x<_x+3)&&(p.x>_x-3))&&((p.y<_y+3)&&(p.y>_y-3))){
        
        _status = false;
        }
     */   
        if(_y > HEIGHT)
        {
            _status = false;
        }
}

void Obstacles::update()
{
   _y =_y+1;
  /* if(!_status)
   {
       _y = HEIGHT + 3;
       }*/
}



Vector2D Obstacles::get_pos() {
    Vector2D p = {_x,_y};
    return p;    
}
bool Obstacles::get_status(){
    return _status;
    
    }