ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18jgb

Dependencies:   mbed

Revision:
17:18ae81180853
Parent:
13:cfdfe60a2327
Child:
18:c600a6545e81
--- a/Spikes/Spikes.cpp	Tue May 19 13:49:30 2020 +0000
+++ b/Spikes/Spikes.cpp	Tue May 19 16:55:43 2020 +0000
@@ -46,13 +46,27 @@
         _x = rand() % 37 + 42;
         _y = 1;
     }
+    if (x == 3){
+        _y = rand() % 19 + 1;
+        _x = 1;
+    }
+    if (x == 4){
+        _y = rand() % 19 + 24;
+        _x = 1;
+    }
 }
 
-void Spikes::update()
+void Spikes::updatey()
 {
     _y = _y + 3;
 }
 
+void Spikes::updatex()
+{
+    _x = _x + 3;
+}
+
+
 Vector2D Spikes::get_pos() {
     Vector2D p = {_x,_y};
     return p;    
@@ -62,6 +76,8 @@
 {
     pad.led(1,1);
     pad.led(4,1);
+    wait(0.2);
+    pad.leds_off();
 }
 
     
\ No newline at end of file