The classic dueling tanks game for mbed.
Dependencies: 4DGL-uLCD-SE DRV2605 EthernetInterface Game_Synchronizer MMA8452 SDFileSystem SparkfunAnalogJoystick mbed-rtos mbed wave_player
Fork of 2035_Tanks_Shell by
Diff: Tank/tank.h
- Revision:
- 21:edfeb289b21f
- Parent:
- 14:36c306e26317
- Child:
- 22:3c68eea5a609
--- a/Tank/tank.h Thu Oct 29 02:21:11 2015 +0000 +++ b/Tank/tank.h Thu Oct 29 03:56:30 2015 +0000 @@ -4,24 +4,33 @@ class Tank { public: - int x, y; - int w; - int h; - int tank_color; - float barrel_theta; - int barrel_length; - int wheel_rad; + + int x, y; // Keep track of your tank's position. + int w; // Tank width. + int h; // Tank height. + int tank_color; // Tank color. Duh :) + float barrel_theta; // Barrel angle. + int barrel_length; // Length of the barrel. + int wheel_rad; // Radius of the wheels. + // Construct a tank given its starting position (sx, sy), + // its width and height, and its color. Tank(int sx, int sy, int width, int height, int color); + + // Calculate the bounding box of your tank for collision checking. int min_x(void); int min_y(void); int max_x(void); int max_y(void); + // Calculate the position of the end of the barrel. void barrel_end(int& bx, int& by); - void reposition(int new_x, int new_y, float new_theta); + // Reposition the tank! + void reposition(int dx, int dy, float dtheta); + + // Draw the tank! void draw(); };