James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Revision:
42:347c20a16ee6
Parent:
41:fe383cbb51b2
Child:
45:b1ac80481d4f
--- a/BreakoutEngine/BreakoutEngine.cpp	Fri Apr 26 08:11:02 2019 +0000
+++ b/BreakoutEngine/BreakoutEngine.cpp	Fri Apr 26 08:27:50 2019 +0000
@@ -162,11 +162,10 @@
     
     lives_leds(pad);
     
-    check_wall_collision(pad);
+    check_wall_collisions(pad);
     check_paddle_collisions(pad);
     check_brick_collisions(pad);
     check_laser_collisions(pad);
-    check_laser_ceiling_collision();
     
     
 }
@@ -218,7 +217,7 @@
     return _p1.get_lives();
 }
 
-void BreakoutEngine::check_wall_collision(Gamepad &pad)
+void BreakoutEngine::check_wall_collisions(Gamepad &pad)
 {
     // read current ball attributes
     Vector2D ball_pos = _ball.get_pos();
@@ -251,18 +250,15 @@
     _ball.set_velocity(ball_velocity);
     _ball.set_pos(ball_pos);
     
-}
-
-void BreakoutEngine::check_laser_ceiling_collision()
-{   
-    for (it_L = listofLasers.begin(); it_L != listofLasers.end(); ++it_L){
+     for (it_L = listofLasers.begin(); it_L != listofLasers.end(); ++it_L){
         if (
-            (it_L -> get_y() <= GAP_TOP - 1)
+            (it_L -> get_y() <= GAP_TOP - 2)
         ) {    // edit this so that if it hits the middle, reflect, else change angle depending on how far off centre (add angle to ball)
             // if it has, fix position and reflect x velocity  
             it_L -> set_posx(-10);
         }
     }
+    
 }
 
 void BreakoutEngine::check_paddle_collisions(Gamepad &pad)