ELEC2645 (2018/19) / Mbed 2 deprecated el17szs

Dependencies:   mbed

Revision:
31:eefa1d23a843
Parent:
30:43aace0fdbdf
Child:
33:9d34ef219fff
--- a/Bat/Bat.cpp	Wed May 08 01:20:06 2019 +0000
+++ b/Bat/Bat.cpp	Wed May 08 12:13:28 2019 +0000
@@ -11,42 +11,44 @@
 
 }
 //Initialises the UX Object
-void Bat::init(int x,int y)
+void Bat::init(int width,int height)
 {   
     //assigns the x and y co-ordinates for the bat to be printed to the LCD
-    _bat_x = 42;
-    _bat_y = 15;
+    _bat_width = width;
+    _bat_height = height;
     
     //initialises the Bat class flags to 0
-    _hitBall=0;
+    _hit_ball=0;
     _loft_ball=0;
 }
 
 //Resets the bat flags to 0
 void Bat::reset(){
-    _hitBall=0;
+    _hit_ball=0;
     _loft_ball=0;
 }
 
 //Draws the bat on the LCD
 void Bat::draw(N5110 &lcd){
     lcd.drawLine(38,36,41,36,1);
-    lcd.drawRect(41,35,6,3,FILL_BLACK);
+    lcd.drawRect(41,35,_bat_width,_bat_height,FILL_BLACK);
 }
+
 //Checks if the ball has been hit during the game play
-//if true the loft ball variable is 1 and returned to the caller
+//if true the hit ball variable is set to 1 and returned to the caller
 /* The bat passes UX as the argument because CHECK_EVENT function of the gamepad did 
    did not respond when using the Gamepad object declared in the main function*/
-int Bat::get_hitBall(UX &ux){ 
-    _hitBall=ux.get_a_pressed();
+int Bat::get_hit_ball(UX &ux){ 
+    _hit_ball=ux.get_a_pressed();
     //printf("_hitBall %i \n",_hitBall); //used for debugging to get the flag value
-    return _hitBall; 
+    return _hit_ball; 
 }
+
 //Checks if the ball has been hit during the game play
 //if true the loft ball variable is 1 and returned to the caller
 int Bat::get_loft_ball(UX &ux){
      _loft_ball=ux.get_l_pressed();
-     //printf("_loftBall %i \n",_loftBall);
+     //printf("_loftBall %i \n",_loftBall); //used for debugging to
     return _loft_ball;
 }