Yang Hongxiao 201199678

Dependencies:   mbed

Revision:
1:a6ead8050c23
diff -r 4b02786450c0 -r a6ead8050c23 Obstacle.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Obstacle.cpp	Thu May 14 17:00:34 2020 +0000
@@ -0,0 +1,34 @@
+#include "Obstacle.h"
+
+ 
+Obstacle::Obstacle(){
+    
+}
+    
+Obstacle::~Obstacle(){
+    
+}
+void Obstacle::init(){
+        
+       _x=20;
+       _y=10;
+}
+    
+void Obstacle::draw(N5110 &lcd){
+        
+     lcd.drawRect(_x,_y,20,2,FILL_BLACK);
+            
+}
+    
+void Obstacle::new_obstacle(){
+        
+        srand(time(NULL));
+        _x=rand()%(84-20); 
+        _y=rand()%(47-10);
+}
+ 
+Vector2D Obstacle::get_obstacle_pos() {
+    Vector2D p = {_x,_y};
+    return p;    
+}   
+