ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Revision:
15:81a3aaf52647
Parent:
14:122eaa3b7a50
Child:
17:b2b651acffae
Child:
18:a260ce8db9e7
--- a/Ball/Ball.cpp	Tue Apr 23 20:57:15 2019 +0000
+++ b/Ball/Ball.cpp	Wed Apr 24 21:17:22 2019 +0000
@@ -17,6 +17,7 @@
     _y1=3;
     _x = 42;
     _y = 15;
+    set_tone=0;
     bat.init(3,4);
     bowled=0;
 
@@ -32,17 +33,21 @@
     _x = p.x;
     _y = p.y;
 }
-int Ball::bowler_start(){
+int Ball::bowler_start(Gamepad &pad){
     if(_y1!=15){
         _y1+=1;
         return 0;
     }
     else {
+        if (set_tone==0){
+            //pad.tone(750.0,0.3);
+            set_tone=1;
+        }
         return 1;
     }
 }
-int Ball::ball_start(){
-   int bowler_start_check=bowler_start();
+int Ball::ball_start(Gamepad &pad){
+   int bowler_start_check=bowler_start(pad);
    if (bowler_start_check==1){
          if (_y!=36){ 
             _y+=1;
@@ -78,7 +83,8 @@
      else{
          _x++;
     }
-}
+   }
+printf(" %i %i %i %i \n",_x,expected_x,_y,expected_y);
 if (_x==expected_x && _y==expected_y){
     return 1;
 }
@@ -99,6 +105,7 @@
     _y1=3;
     _x = 42;
     _y = 15;
+    set_tone=0;
 }