pocket tanks
Dependencies: 4DGL-uLCD-SE pockettanks SDFileSystem mbed wave_player
Fork of ECE2035_FroggerGame_SUM1025 by
cars/cars.h@3:8f68c00dd75a, 2015-10-22 (annotated)
- Committer:
- ece2035ta
- Date:
- Thu Oct 22 03:47:32 2015 +0000
- Revision:
- 3:8f68c00dd75a
- Parent:
- 1:172fbc00199c
hi
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ece2035ta | 1:172fbc00199c | 1 | #include "mbed.h" |
ece2035ta | 1:172fbc00199c | 2 | //#include "cars.h" |
ece2035ta | 1:172fbc00199c | 3 | #include "map_public.h" |
ece2035ta | 1:172fbc00199c | 4 | #include "globals.h" |
ece2035ta | 1:172fbc00199c | 5 | |
ece2035ta | 1:172fbc00199c | 6 | |
ece2035ta | 1:172fbc00199c | 7 | //void clearCar(int lane); |
ece2035ta | 1:172fbc00199c | 8 | //void moveCar(int whichOne); // 1 -> lane 1. 2 -> lane 2 etc |
ece2035ta | 1:172fbc00199c | 9 | |
ece2035ta | 1:172fbc00199c | 10 | |
ece2035ta | 1:172fbc00199c | 11 | |
ece2035ta | 1:172fbc00199c | 12 | /// The enum defines the motion of the car |
ece2035ta | 1:172fbc00199c | 13 | typedef enum { |
ece2035ta | 1:172fbc00199c | 14 | CAR_UP=0, ///< move up |
ece2035ta | 1:172fbc00199c | 15 | CAR_DOWN, ///< move down |
ece2035ta | 1:172fbc00199c | 16 | } CAR_MOTION; |
ece2035ta | 1:172fbc00199c | 17 | |
ece2035ta | 1:172fbc00199c | 18 | typedef struct |
ece2035ta | 1:172fbc00199c | 19 | { |
ece2035ta | 1:172fbc00199c | 20 | unsigned int car_blk_x; ///< horizontal position in the grid |
ece2035ta | 1:172fbc00199c | 21 | unsigned int car_blk_y; ///< vertical position in the grid |
ece2035ta | 1:172fbc00199c | 22 | unsigned int car_color; ///< color of the car |
ece2035ta | 1:172fbc00199c | 23 | unsigned int lane; //car lane |
ece2035ta | 1:172fbc00199c | 24 | CAR_MOTION car_motion; ///< the motion of the car |
ece2035ta | 1:172fbc00199c | 25 | } car_t; |
ece2035ta | 1:172fbc00199c | 26 | |
ece2035ta | 1:172fbc00199c | 27 | void car_move(car_t * g, unsigned int new_blk_x, unsigned int new_blk_y); //A function to move the car |
ece2035ta | 1:172fbc00199c | 28 | //void drawCar(car_t * g, int grid_x, int grid_y); // @param lane @param color I don't think this function needs to be public |
ece2035ta | 1:172fbc00199c | 29 | void car_init(car_t * g); // Initialize a car |
ece2035ta | 1:172fbc00199c | 30 | void drive(car_t*); |
ece2035ta | 1:172fbc00199c | 31 | void collision(); |