SharpShooter

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

Revision:
5:f51cdddf541e
Parent:
4:dbd0e3604beb
Parent:
3:7a7157ff710f
Child:
6:7f8c3169483a
Child:
8:56a24df93680
--- a/Obstacle.h	Thu Oct 27 23:15:29 2016 +0000
+++ b/Obstacle.h	Fri Oct 28 00:36:11 2016 +0000
@@ -1,4 +1,48 @@
 class Obstacle
 {
-    Joe
-};
\ No newline at end of file
+    int x1,x2,y1,y2;
+    uLCD_4DGL uLCD;
+    bool direction;
+
+public:
+    Obstacle(int x1, int x2, int y1, int y2, uLCD_4DGL uLCD);
+    void drawObstacle();
+    void move(int speed);
+    void updateLocation();
+    void setULCD(uLCD_4DGL uLCD);
+    void changeDirection();// need change direction when hitting wall
+    void setDirection(bool direction);
+};
+
+Obstacle::Obstacle(int a, int b, int c, int d, uLCD_4DGL e) {
+    x1 = a;
+    x2 = b;
+    y1 = c;
+    y2 = d;
+    this->uLCD = e;
+}
+
+void Obstacle::setULCD(
+
+void Obstacle::drawObstacle() {
+    uLCD.filled_rectangle(x1,y1,x2,y2,0xFFFFFF);
+}
+
+void Obstacle::move(int speed) {
+    if (direction==1) {
+        x1 += speed;
+        x2 += speed;
+    }
+    else {
+        x1 -= speed;
+        x2 -= speed;
+    }
+}
+
+void Obstacle::changeDirection() {
+    direction = !direction
+}
+
+void Obstacle::setDirection(bool a) {
+    direction = a;
+}
\ No newline at end of file