SharpShooter
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player
Bullet.h
- Committer:
- SeanBuckingham
- Date:
- 2016-10-28
- Revision:
- 7:ed2c73e25681
- Parent:
- 2:e8f2b2320353
- Child:
- 11:55b65415b6ba
File content as of revision 7:ed2c73e25681:
class Bullet { int x, topY, bottomY; int length = 3; int speed = 3; uLCD_4DGL uLCD; struct Coordinate { int x1, y1, x2, y2; } public: Bullet(uLCD_4DGL uLCD); void drawBullet(int x, int bottomY); void eraseBullet(); void move(); }; Bullet::Bullet(uLCD_4DGL uLCD) { this->uLCD = uLCD; } /*Bullet::Bullet(int x, int bottomY, uLCD_4DGL uLCD) { this->x = x; this->bottomY = bottomY; this->topY = bottomY + length; this->uLCD = uLCD; }*/ void Bullet::drawBullet(int x, int bottomY) { this->x = x; this->bottomY = bottomY; this->topY = bottomY + length; uLCD.line(x,topY,x,bottomY, 0xFFFFFF); } void Bullet::move() { bottomY+= speed; drawBullet(x, bottomY); } void Bullet::eraseBullet() { uLCD.line(x,topY,x,bottomY, 0x000000); } Coordinate Bullet::getLocation() { Coordinate coor = {x, topY, x, bottomY;} return coor; }