James Cummins / Mbed 2 deprecated el17jnc

Dependencies:   mbed

Revision:
32:eff573ad8e42
Parent:
31:c95f1b1d6423
Child:
36:9f7463a65fe0
--- a/Classic_Engine/ClassicEngine.cpp	Sat Apr 27 18:57:06 2019 +0000
+++ b/Classic_Engine/ClassicEngine.cpp	Sun Apr 28 10:20:52 2019 +0000
@@ -33,12 +33,14 @@
 
 bool ClassicEngine::finished(){
     bool finished = false;
-    if(_abs_ball_pos.x == 402  &&       //these are the range of coords the ball
-       _abs_ball_pos.y > 101   &&       //can have as it crosses the finish line
-       _abs_ball_pos.y < 141   ){
-           finished = true;
+    if(_abs_ball_pos.x > 402   &&       //these are the range of coords the ball
+       _abs_ball_pos.x < 407   &&       //can have as it crosses the finish line
+       _abs_ball_pos.y > 101   &&       //must be given as a range rather than an
+       _abs_ball_pos.y < 141   ){       //exact number as .x and .y are floats so 
+           finished = true;             //will never exactly equal 405
     }
     else{ finished = false; }
+    printf("ball pos = %f , %f   |   finished = %d\n", _abs_ball_pos.x, _abs_ball_pos.y, finished);
     return finished;
 }
 
@@ -63,7 +65,7 @@
     while(1){
               wait(0.2);
               lcd.clear();
-              lcd.printString("You lose!", 15, 1);
+              lcd.printString("Game over!", 12, 1);
               lcd.printString("Back = A", 18, 3);
               lcd.printString("Replay = B", 12, 4);
               lcd.refresh();