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

Bullet/bullet.cpp

Committer:
jford38
Date:
2015-10-29
Revision:
22:3c68eea5a609
Parent:
21:edfeb289b21f
Child:
23:77049670cae6

File content as of revision 22:3c68eea5a609:

#include "uLCD_4DGL.h"
#include "bullet.h"
#include "game_synchronizer.h"
#include "misc.h"
#include "math.h"

extern Game_Synchronizer sync;

// Initialize the bullet. Don't have to do much here.
// Just set the speed.
Bullet::Bullet(Tank* t) {
    tank = t;
    //speed = ???;
    in_flight = false;
}

// Set the in_flight flag. Initialize values needed for
// the trajectory calculations.
void Bullet::shoot(void) {
}

// If the bullet is in flight, calculate its new position
// after a time delta dt.
void Bullet::update_position(float dt) {

}

// 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. 
}