frogger game
Dependencies: 4DGL-uLCD-SE MMA8452 SDFileSystem mbed wave_player
Fork of ECE2035_FroggerGame_SUM2015 by
cars/cars.h@8:1b6fc10c5cea, 2015-07-08 (annotated)
- Committer:
- ece2035ta
- Date:
- Wed Jul 08 15:45:22 2015 +0000
- Revision:
- 8:1b6fc10c5cea
Added car files
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ece2035ta | 8:1b6fc10c5cea | 1 | #include "mbed.h" |
ece2035ta | 8:1b6fc10c5cea | 2 | //#include "cars.h" |
ece2035ta | 8:1b6fc10c5cea | 3 | #include "map_public.h" |
ece2035ta | 8:1b6fc10c5cea | 4 | #include "globals.h" |
ece2035ta | 8:1b6fc10c5cea | 5 | |
ece2035ta | 8:1b6fc10c5cea | 6 | |
ece2035ta | 8:1b6fc10c5cea | 7 | //void clearCar(int lane); |
ece2035ta | 8:1b6fc10c5cea | 8 | //void moveCar(int whichOne); // 1 -> lane 1. 2 -> lane 2 etc |
ece2035ta | 8:1b6fc10c5cea | 9 | |
ece2035ta | 8:1b6fc10c5cea | 10 | |
ece2035ta | 8:1b6fc10c5cea | 11 | |
ece2035ta | 8:1b6fc10c5cea | 12 | /// The enum defines the motion of the car |
ece2035ta | 8:1b6fc10c5cea | 13 | typedef enum { |
ece2035ta | 8:1b6fc10c5cea | 14 | CAR_UP=0, ///< move up |
ece2035ta | 8:1b6fc10c5cea | 15 | CAR_DOWN, ///< move down |
ece2035ta | 8:1b6fc10c5cea | 16 | } CAR_MOTION; |
ece2035ta | 8:1b6fc10c5cea | 17 | |
ece2035ta | 8:1b6fc10c5cea | 18 | typedef struct |
ece2035ta | 8:1b6fc10c5cea | 19 | { |
ece2035ta | 8:1b6fc10c5cea | 20 | unsigned int car_blk_x; ///< horizontal position in the grid |
ece2035ta | 8:1b6fc10c5cea | 21 | unsigned int car_blk_y; ///< vertical position in the grid |
ece2035ta | 8:1b6fc10c5cea | 22 | unsigned int car_color; ///< color of the car |
ece2035ta | 8:1b6fc10c5cea | 23 | unsigned int lane; //car lane |
ece2035ta | 8:1b6fc10c5cea | 24 | CAR_MOTION car_motion; ///< the motion of the car |
ece2035ta | 8:1b6fc10c5cea | 25 | } car_t; |
ece2035ta | 8:1b6fc10c5cea | 26 | |
ece2035ta | 8:1b6fc10c5cea | 27 | void car_move(car_t * g, unsigned int new_blk_x, unsigned int new_blk_y); //A function to move the car |
ece2035ta | 8:1b6fc10c5cea | 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 | 8:1b6fc10c5cea | 29 | void car_init(car_t * g); // Initialize a car |
ece2035ta | 8:1b6fc10c5cea | 30 | void drive(car_t*); |
ece2035ta | 8:1b6fc10c5cea | 31 | void collision(); |