Stick_Runner
Dependencies: FXOS8700CQ Gamepad N5110 SDFileSystem mbed
Gems/Gems.cpp
- Committer:
- el15ss
- Date:
- 2017-04-28
- Revision:
- 0:12cfe63faa6a
- Child:
- 1:db9ff66f67c8
File content as of revision 0:12cfe63faa6a:
#include "Gems.h" Gems::Gems() { } Gems::~Gems() { } void Gems::init() { _x = rand() % 84; _y = 0; _status = true; counter; } 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.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); } void Gems::Gems_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 Gems::Gems_Score(Vector2D p) { if(((_x-1<p.x)&&(_x+1>p.x))&&((_y-1<p.y)&&(_y+1>p.y))){ counter++; } } void Gems::update() { _y =_y+2; /* if(!_status) { _y = HEIGHT + 3; }*/ } Vector2D Gems::get_pos() { Vector2D p = {_x,_y}; return p; } bool Gems::get_status(){ return _status; }