SharpShooter
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player
Bullet.h
- Committer:
- jboettcher
- Date:
- 2016-10-28
- Revision:
- 11:55b65415b6ba
- Parent:
- 7:ed2c73e25681
- Child:
- 12:2f358065ba3f
File content as of revision 11:55b65415b6ba:
extern uLCD_4DGL uLCD; struct BulletLocation { int x, topY, bottomY; }; class Bullet { int x, topY, bottomY; int length; int speed; public: Bullet(); void drawBullet(int x, int bottomY); void eraseBullet(); void move(); BulletLocation getLocation(); }; Bullet::Bullet() { length = 3; speed = 3; x=1; topY=2; bottomY=3; } /*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); } BulletLocation Bullet::getLocation() { BulletLocation coor {x, topY, bottomY}; return coor; }