For Nikhil
Dependencies: 4DGL-uLCD-SE EthernetInterface Game_Synchronizer MMA8452 SDFileSystem mbed-rtos mbed wave_player
Fork of 2035_Tanks_Shell by
Tank/tank.h@23:77049670cae6, 2015-10-30 (annotated)
- Committer:
- jford38
- Date:
- Fri Oct 30 08:54:10 2015 +0000
- Revision:
- 23:77049670cae6
- Parent:
- 22:3c68eea5a609
Final final final version. Maybe. For now. Ugh.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
jford38 | 14:36c306e26317 | 1 | #ifndef TANK_H__ |
jford38 | 14:36c306e26317 | 2 | #define TANK_H__ |
jford38 | 14:36c306e26317 | 3 | |
jford38 | 23:77049670cae6 | 4 | // This class describes a tank. You may need to add |
jford38 | 23:77049670cae6 | 5 | // additional member variables (and maybe even member functions) |
jford38 | 23:77049670cae6 | 6 | // to draw your super cool new tank. |
jford38 | 14:36c306e26317 | 7 | |
jford38 | 14:36c306e26317 | 8 | class Tank { |
jford38 | 14:36c306e26317 | 9 | public: |
jford38 | 21:edfeb289b21f | 10 | |
jford38 | 21:edfeb289b21f | 11 | int x, y; // Keep track of your tank's position. |
jford38 | 21:edfeb289b21f | 12 | int w; // Tank width. |
jford38 | 21:edfeb289b21f | 13 | int h; // Tank height. |
jford38 | 21:edfeb289b21f | 14 | int tank_color; // Tank color. Duh :) |
jford38 | 21:edfeb289b21f | 15 | float barrel_theta; // Barrel angle. |
jford38 | 21:edfeb289b21f | 16 | int barrel_length; // Length of the barrel. |
jford38 | 21:edfeb289b21f | 17 | int wheel_rad; // Radius of the wheels. |
jford38 | 14:36c306e26317 | 18 | |
jford38 | 14:36c306e26317 | 19 | |
jford38 | 21:edfeb289b21f | 20 | // Construct a tank given its starting position (sx, sy), |
jford38 | 21:edfeb289b21f | 21 | // its width and height, and its color. |
jford38 | 14:36c306e26317 | 22 | Tank(int sx, int sy, int width, int height, int color); |
jford38 | 21:edfeb289b21f | 23 | |
jford38 | 21:edfeb289b21f | 24 | // Calculate the bounding box of your tank for collision checking. |
jford38 | 14:36c306e26317 | 25 | int min_x(void); |
jford38 | 14:36c306e26317 | 26 | int min_y(void); |
jford38 | 14:36c306e26317 | 27 | int max_x(void); |
jford38 | 14:36c306e26317 | 28 | int max_y(void); |
jford38 | 14:36c306e26317 | 29 | |
jford38 | 21:edfeb289b21f | 30 | // Calculate the position of the end of the barrel. |
jford38 | 22:3c68eea5a609 | 31 | void barrel_end(int* bx, int* by); |
jford38 | 14:36c306e26317 | 32 | |
jford38 | 21:edfeb289b21f | 33 | // Reposition the tank! |
jford38 | 21:edfeb289b21f | 34 | void reposition(int dx, int dy, float dtheta); |
jford38 | 21:edfeb289b21f | 35 | |
jford38 | 21:edfeb289b21f | 36 | // Draw the tank! |
jford38 | 14:36c306e26317 | 37 | void draw(); |
jford38 | 14:36c306e26317 | 38 | }; |
jford38 | 14:36c306e26317 | 39 | |
jford38 | 14:36c306e26317 | 40 | #endif |