Revenge of the Mouse
Dependencies: 4DGL-uLCD-SE EthernetInterface Game_Synchronizer LCD_fonts MMA8452 SDFileSystem mbed-rtos mbed wave_player
Fork of 2035_Tanks_Shell by
Diff: Tank/tank.cpp
- Revision:
- 23:77049670cae6
- Parent:
- 22:3c68eea5a609
- Child:
- 25:b3c075a2f2c7
--- a/Tank/tank.cpp Thu Oct 29 05:14:49 2015 +0000 +++ b/Tank/tank.cpp Fri Oct 30 08:54:10 2015 +0000 @@ -46,13 +46,17 @@ } void Tank::reposition(int dx, int dy, float dtheta) { - // Move the tank dx pixels in the x direction. - // Move the tank dy pixels in the y direction. - // Move the tank barrel by an angle dtheta. Don't allow it to go below parallel. + // Blank out the old tank position, and + // Move the tank dx pixels in the x direction. + // Move the tank dy pixels in the y direction. + // Move the tank barrel by an angle dtheta. Don't allow it to go below parallel. - // Do collision detection to prevent the tank from hitting things. + // Do collision detection to prevent the tank from hitting things. + // (obstacles, side of the screen, other tanks, etc.) } + +// Example tank draw function. We expect you to get creative on this one! void Tank::draw() { sync.line(x + w/2.0, y+h+wheel_rad, x + w/2.0 + barrel_length*cos(barrel_theta), y+h+wheel_rad + barrel_length*sin(barrel_theta), BLACK); sync.filled_rectangle(x, y+wheel_rad, x+w, y+h+wheel_rad, tank_color);