James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Revision:
76:52410264a72d
Parent:
75:d96b177585aa
Child:
77:d50fb95c012f
--- a/BreakoutEngine/BreakoutEngine.cpp	Mon May 06 13:02:03 2019 +0000
+++ b/BreakoutEngine/BreakoutEngine.cpp	Mon May 06 13:07:19 2019 +0000
@@ -37,7 +37,7 @@
 
     // puts paddles and ball in middle
     _p1.init(_p1y,_paddle_height,_paddle_width);
-    _ball.init(_ball_size,_speed);
+    _ball.init(_ball_size,_speed,_p1.get_pos().x + 7);
     
     _brick11.init(3,GAP_TOP+1,BRICK_HEIGHT,BRICK_WIDTH,3);                              // need to figure out how to make a list of these
     _brick12.init(16,GAP_TOP+1,BRICK_HEIGHT,BRICK_WIDTH,3);
@@ -92,7 +92,7 @@
 void BreakoutEngine::reset()  // rename to reset add in ball reset and use to increase the number of balls each time
 {    
     reset_num_left();
-    _ball.init(_ball_size,_speed + _multiplier/2); // replace the 1 with a multiplier private variable that tracks the number of times continued from victory
+    _ball.init(_ball_size,_speed + _multiplier/2, _p1.get_pos().x + 7); // replace the 1 with a multiplier private variable that tracks the number of times continued from victory
     _p1.recentre();
     int pointer = 0;
     for (it_R = listofBricks.begin(); it_R != listofBricks.end(); ++it_R){
@@ -424,7 +424,7 @@
         _p1.lose_life();
         //lose_screen(); // go to loss screen then initialise again
         
-        _ball.init(_ball_size,_speed+_multiplier/2);
+        _ball.init(_ball_size,_speed+_multiplier/2,_p1.get_pos().x + 7);
         pad.tone(1500.0,0.5);
         return true;
     }