For Nikhil

Dependencies:   4DGL-uLCD-SE EthernetInterface Game_Synchronizer MMA8452 SDFileSystem mbed-rtos mbed wave_player

Fork of 2035_Tanks_Shell by ECE2035 Spring 2015 TA

Revision:
23:77049670cae6
Parent:
22:3c68eea5a609
Child:
26:317310d660b2
--- a/Bullet/bullet.cpp	Thu Oct 29 05:14:49 2015 +0000
+++ b/Bullet/bullet.cpp	Fri Oct 30 08:54:10 2015 +0000
@@ -7,16 +7,20 @@
 extern Game_Synchronizer sync;
 
 // Initialize the bullet. Don't have to do much here.
-// Just set the speed.
+// Keep a pointer to this bullet's tank.
+// Set the speed, and default the bullet to not in_flight.
 Bullet::Bullet(Tank* t) {
     tank = t;
     //speed = ???;
     in_flight = false;
 }
 
-// Set the in_flight flag. Initialize values needed for
-// the trajectory calculations.
+// If in_flight, do nothing. Otherwise,
+// set the in_flight flag, and initialize values needed for
+// the trajectory calculations. (x0, y0), (vx0, vy0), time
+// Hint: tank->barrel_end(...) is useful here.
 void Bullet::shoot(void) {
+    in_flight = true;
 }
 
 // If the bullet is in flight, calculate its new position
@@ -25,14 +29,15 @@
 
 }
 
-// return codes:
-//      BULLET_NO_COLLISION: no collision
-//      BULLET_OFF_SCREEN:   off the side of the screen
-//      Otherwise, returns the color you've hit in 16bpp format. 
-
 int Bullet::time_step(float dt) {
     // If the bullet hasn't hit anything, 
     // redraw the bullet at its new location. 
-    // If it has hit something (obstacle, tank, edge of the screen), return
-    // a descriptive error code. 
+    // If it has hit something (obstacle, tank, edge of the screen), 
+    // set the in_flight flag back to false and return
+    // one of the following codes.
+    //
+    // return codes:
+    //      BULLET_NO_COLLISION: no collision
+    //      BULLET_OFF_SCREEN:   off the side of the screen
+    //      Otherwise, return the color you've hit in 16bpp format. 
 }
\ No newline at end of file