James Heavey / Mbed 2 deprecated EL17JH

Dependencies:   mbed

Revision:
109:5ba766522df0
Parent:
108:91da12db6f26
Child:
111:4848c399fae0
--- a/BreakoutEngine/BreakoutEngine.cpp	Wed May 08 01:08:47 2019 +0000
+++ b/BreakoutEngine/BreakoutEngine.cpp	Wed May 08 01:43:04 2019 +0000
@@ -22,7 +22,7 @@
     _cool_time = 0.0f; // time remaining before laser can be fired again, starts at 0
     _score = 0; // initialised as 0
     _prev_score = 0;  // initialised as 0 for the first round
-    _multiplier = 1;  // initialised as 1 for the first round
+    _multiplier = 0;  // initialised as 1 for the first round
 
     // y position of the paddle on screen - HEIGHT is defined in N5110.h
     _paddley = HEIGHT - GAP - 1;
@@ -88,7 +88,7 @@
 {
     reset_num_left();   // resets _number_left to 18
     _paddle.recentre();  // recentres the paddle on screen
-    _ball.init(_ball_size,_speed + _multiplier/2 - 0.5, _paddle.get_pos().x + (PADDLE_WIDTH/2)); // resets the ball position to above the paddle, and increases its speed depending on the _multiplier
+    _ball.init(_ball_size,_speed + _multiplier/2, _paddle.get_pos().x + (PADDLE_WIDTH/2)); // resets the ball position to above the paddle, and increases its speed depending on the _multiplier
     
     int pointer = 0;  // tracks the rows, if 6 bricks are placed, it moves to the next row
     for (it_R = listofBricks.begin(); it_R != listofBricks.end(); ++it_R) {
@@ -100,7 +100,7 @@
             it_R -> set_posx(((pointer-12) * 13) + 3);  // pointer - 12 to offset it back to the first column of bricks
         }
 
-        it_R -> reset_lives(_multiplier - 1);  // increases the bricks number of lives by the multiplier + their _base_lives
+        it_R -> reset_lives(_multiplier);  // increases the bricks number of lives by the multiplier + their _base_lives
         pointer ++;  // increment the pointer
     }
     for (it_L = listofLasers.begin(); it_L != listofLasers.end(); ++it_L) {
@@ -417,7 +417,7 @@
 void BreakoutEngine::print_scores(N5110 &lcd) 
 {
     // get scores from paddles
-    int score = _prev_score + (18 - get_num_left())*100 * _multiplier;     //maybe add a previous score so the score carries over through victory screens. add hi score fix so restart restarts from 321
+    int score = _prev_score + (18 - get_num_left())*100 * (_multiplier + 1);     //maybe add a previous score so the score carries over through victory screens. add hi score fix so restart restarts from 321
     // also, add a multiplier of 2 for every contiue on victory
     _score = score;
 
@@ -473,9 +473,9 @@
     return _multiplier;
 }
 
-void BreakoutEngine::set_mult_one()
+void BreakoutEngine::set_mult_zero()
 {
-    _multiplier = 1;
+    _multiplier = 0;
 }
 
 void BreakoutEngine::inc_index()