class for bullet in Car_race game

Revision:
7:b852cf8f4f36
Parent:
6:581257752de1
Child:
8:89a98a3d7233
diff -r 581257752de1 -r b852cf8f4f36 Bullet.cpp
--- a/Bullet.cpp	Sat Apr 15 18:18:39 2017 +0000
+++ b/Bullet.cpp	Sun Apr 16 19:04:08 2017 +0000
@@ -15,7 +15,7 @@
     _bullet_x =  _CarHead.x;
     _bullet_y =  _CarHead.y + 2;
     
-    printf("x=%d y=%d \n",_bullet_x,_bullet_y);
+    // printf("x=%d y=%d \n",_bullet_x,_bullet_y);
 }
 
 void Bullet::draw(N5110 &lcd)
@@ -38,7 +38,7 @@
     lcd.setPixel(_bullet_x,_bullet_y+1,false);
     lcd.setPixel(_bullet_x+1,_bullet_y,false);
     lcd.setPixel(_bullet_x+1,_bullet_y+1,false);
-    
+    // printf("x=%d y=%d \n",_bullet_x,_bullet_y);
     if(_bulletDirection==1) {
     _bullet_x = _bullet_x;
     _bullet_y = _bullet_y - 3; 
@@ -55,9 +55,9 @@
     _bullet_y = _bullet_y - 3; 
     }
     
-    // the problem is apparently due to the ball being darw with coordinates 1,1 and particularly X=1
-    if ((_bullet_x == 1)) {
-       clearBullet(lcd);
+    // the following piece of code to get around the problem of the game getting stuck when the value of _bullet_x = 1 
+   if ((_bullet_x == 0)) {
+      clearBullet(lcd);
        _bullet_x = _bullet_x - 1;
        _bullet_y = _bullet_y - 1; 
     }