Missile Control Game with uLCD
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed wave_player
Fork of missile_command by
player.h@2:eba4ed0263a4, 2015-10-20 (annotated)
- Committer:
- ajindia6
- Date:
- Tue Oct 20 19:13:03 2015 +0000
- Revision:
- 2:eba4ed0263a4
- Parent:
- 0:532cb55d6136
Mbed Mission Control Game
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
arvahsu | 0:532cb55d6136 | 1 | // Template of player header file |
arvahsu | 0:532cb55d6136 | 2 | #ifndef PLAYER_H |
arvahsu | 0:532cb55d6136 | 3 | #define PLAYER_H |
arvahsu | 0:532cb55d6136 | 4 | |
ajindia6 | 2:eba4ed0263a4 | 5 | // Player settings |
arvahsu | 0:532cb55d6136 | 6 | #define PLAYER_WIDTH 10 |
arvahsu | 0:532cb55d6136 | 7 | #define PLAYER_HEIGHT 3 |
arvahsu | 0:532cb55d6136 | 8 | #define PLAYER_DELTA 3 |
arvahsu | 0:532cb55d6136 | 9 | #define PLAYER_COLOR 0x0000FF |
ajindia6 | 2:eba4ed0263a4 | 10 | #define BLACK_COLOR 0x000000 |
ajindia6 | 2:eba4ed0263a4 | 11 | #define YELLOW_COLOR 0xFFFF00 |
ajindia6 | 2:eba4ed0263a4 | 12 | #define GREEN_COLOR 0x00FF00 |
ajindia6 | 2:eba4ed0263a4 | 13 | |
ajindia6 | 2:eba4ed0263a4 | 14 | |
arvahsu | 0:532cb55d6136 | 15 | |
arvahsu | 0:532cb55d6136 | 16 | |
ajindia6 | 2:eba4ed0263a4 | 17 | typedef enum { |
ajindia6 | 2:eba4ed0263a4 | 18 | PLAYER_MISSILE_EXPLODED=2,///<missile has been destroyed |
ajindia6 | 2:eba4ed0263a4 | 19 | PLAYER_MISSILE_ACTIVE=1,///<missile is active |
ajindia6 | 2:eba4ed0263a4 | 20 | PLAYER_MISSILE_DEACTIVE=0///<missile is no longer active |
ajindia6 | 2:eba4ed0263a4 | 21 | } PLAYER_MISSILE_STATUS; |
ajindia6 | 2:eba4ed0263a4 | 22 | //Initialize ANTI-missile structure |
ajindia6 | 2:eba4ed0263a4 | 23 | |
ajindia6 | 2:eba4ed0263a4 | 24 | typedef struct { |
ajindia6 | 2:eba4ed0263a4 | 25 | int x; |
ajindia6 | 2:eba4ed0263a4 | 26 | int origin_y; ///< The x-coordinate of missile current position |
ajindia6 | 2:eba4ed0263a4 | 27 | int y; ///< The y-coordinate of missile current position |
ajindia6 | 2:eba4ed0263a4 | 28 | int source_x; |
ajindia6 | 2:eba4ed0263a4 | 29 | int source_y; |
ajindia6 | 2:eba4ed0263a4 | 30 | PLAYER_MISSILE_STATUS status; ///< The missile status, see MISSILE_STATUS |
ajindia6 | 2:eba4ed0263a4 | 31 | |
ajindia6 | 2:eba4ed0263a4 | 32 | } PLAYER_MISSILE; |
ajindia6 | 2:eba4ed0263a4 | 33 | //Initialize PLAYER structure |
ajindia6 | 2:eba4ed0263a4 | 34 | typedef struct { |
ajindia6 | 2:eba4ed0263a4 | 35 | int x; |
ajindia6 | 2:eba4ed0263a4 | 36 | int y; |
ajindia6 | 2:eba4ed0263a4 | 37 | int numMissile; |
ajindia6 | 2:eba4ed0263a4 | 38 | int lives; |
ajindia6 | 2:eba4ed0263a4 | 39 | |
ajindia6 | 2:eba4ed0263a4 | 40 | |
ajindia6 | 2:eba4ed0263a4 | 41 | } PLAYER; |
ajindia6 | 2:eba4ed0263a4 | 42 | //Declare functions |
ajindia6 | 2:eba4ed0263a4 | 43 | void player_missile_draw(PLAYER_MISSILE player_missile, int color); |
arvahsu | 0:532cb55d6136 | 44 | void player_draw(int x, int y); |
ajindia6 | 2:eba4ed0263a4 | 45 | void player_delete(int x, int y); |
ajindia6 | 2:eba4ed0263a4 | 46 | void missile_start(int counter); |
ajindia6 | 2:eba4ed0263a4 | 47 | void player_set_exploded(int index); |
ajindia6 | 2:eba4ed0263a4 | 48 | void gameover(int s); |
arvahsu | 0:532cb55d6136 | 49 | |
arvahsu | 0:532cb55d6136 | 50 | #endif //PLAYER_H |