SharpShooter

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed-rtos mbed wave_player

Revision:
7:ed2c73e25681
Parent:
2:e8f2b2320353
Child:
11:55b65415b6ba
--- a/Bullet.h	Thu Oct 27 23:15:24 2016 +0000
+++ b/Bullet.h	Fri Oct 28 00:36:52 2016 +0000
@@ -1,4 +1,48 @@
 class Bullet {
     
-    
-};
\ No newline at end of file
+        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;
+}