James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Revision:
35:3a614d539a54
Parent:
34:07ded1f83c59
Child:
36:cb73014d3a99
--- a/BreakoutEngine/BreakoutEngine.cpp	Thu Apr 25 20:26:50 2019 +0000
+++ b/BreakoutEngine/BreakoutEngine.cpp	Thu Apr 25 20:32:41 2019 +0000
@@ -72,6 +72,10 @@
     _laser1.init(-10);
     _laser2.init(-10);
     _laser3.init(-10);
+    
+    listofLasers.push_back(_laser1);
+    listofLasers.push_back(_laser2);
+    listofLasers.push_back(_laser3);
 }
 
 void BreakoutEngine::read_input(Gamepad &pad, bool x)
@@ -139,10 +143,9 @@
     for (it = listofBricks.begin(); it != listofBricks.end(); ++it){
         it->draw(lcd);
     }
-    
-    _laser1.draw(lcd);
-    _laser2.draw(lcd);
-    _laser3.draw(lcd);
+    for (it_L = listofLasers.begin(); it_L != listofLasers.end(); ++it_L){
+        it_L->draw(lcd);
+    }
 
 }
 
@@ -154,15 +157,19 @@
     // correct for it before updating the display
     _p1.update(_d,_mag);
     _ball.update();
-    _laser1.update();
-    _laser2.update();
-    _laser3.update();
+    
+    for (it_L = listofLasers.begin(); it_L != listofLasers.end(); ++it_L){
+        it_L->update();
+    }
+    
     lives_leds(pad);
     
     check_wall_collision(pad);
     check_paddle_collisions(pad);
     check_brick_collisions(pad);
     //check_laser_collisions(pad);
+    
+    
 }
 
 void BreakoutEngine::lives_leds(Gamepad &pad)