ELEC2645 (2019/20) / Mbed 2 deprecated ELEC2645_Project_el18rg

Dependencies:   mbed Gamepad2 ELEC2645_Project_el18rg

Dependents:   ELEC2645_Project_el18rg

Revision:
22:0b207694a5f7
Parent:
19:bdfab290446a
--- a/Swatter/Swatter.cpp	Fri May 29 21:16:37 2020 +0000
+++ b/Swatter/Swatter.cpp	Fri May 29 21:31:43 2020 +0000
@@ -5,11 +5,11 @@
 
 void Swatter::init(int x,int height,int width)  //initilises the swatter parameters
 {
-    _x = x;
-    _y = HEIGHT - 10;
-    _height = height;
-    _width = width;
-    _speed = 1;
+    _x = x;                                  //x-axis of swatter
+    _y = HEIGHT - 10;                        //y-axis of swatter
+    _height = height;                        //height
+    _width = width;                          //width
+    _speed = 1;                              //speed
 }
 
 void Swatter::draw(N5110 &lcd)              //draws the swatter
@@ -39,8 +39,8 @@
     if (_x < 1) {                           //stops the swatter moving off the left side of the screen
         _x = 1;
     }                                       //stops the swatter moving off the right side of the screen
-    if (_x > WIDTH - _width - 1) {
-        _x = WIDTH - _width - 8;
+    if (_x > 75) {
+        _x = 75;
     }
 }