Missile Control Game with uLCD
Dependencies: 4DGL-uLCD-SE SDFileSystem mbed wave_player
Fork of missile_command by
missile/missile_public.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 | #ifndef MISSILE_PUBLIC_H |
arvahsu | 0:532cb55d6136 | 2 | #define MISSILE_PUBLIC_H |
arvahsu | 0:532cb55d6136 | 3 | |
arvahsu | 0:532cb55d6136 | 4 | ///The missile status |
arvahsu | 0:532cb55d6136 | 5 | typedef enum { |
arvahsu | 0:532cb55d6136 | 6 | MISSILE_EXPLODED=2,///<missile has been destroyed |
arvahsu | 0:532cb55d6136 | 7 | MISSILE_ACTIVE=1,///<missile is active |
arvahsu | 0:532cb55d6136 | 8 | MISSILE_DEACTIVE=0///<missile is no longer active |
arvahsu | 0:532cb55d6136 | 9 | } MISSILE_STATUS; |
arvahsu | 0:532cb55d6136 | 10 | |
ajindia6 | 2:eba4ed0263a4 | 11 | |
arvahsu | 0:532cb55d6136 | 12 | /// The structure to store the information of a missile |
arvahsu | 0:532cb55d6136 | 13 | typedef struct { |
arvahsu | 0:532cb55d6136 | 14 | int x; ///< The x-coordinate of missile current position |
arvahsu | 0:532cb55d6136 | 15 | int y; ///< The y-coordinate of missile current position |
arvahsu | 0:532cb55d6136 | 16 | double source_x; ///< The x-coordinate of the missile's origin |
arvahsu | 0:532cb55d6136 | 17 | double target_x; ///< The x-coordinate of the missile's target |
arvahsu | 0:532cb55d6136 | 18 | int tick; ///< The missile's internal tick |
arvahsu | 0:532cb55d6136 | 19 | MISSILE_STATUS status; ///< The missile status, see MISSILE_STATUS |
arvahsu | 0:532cb55d6136 | 20 | } MISSILE; |
arvahsu | 0:532cb55d6136 | 21 | |
arvahsu | 0:532cb55d6136 | 22 | #define MAX_NUM_MISSILE 5 |
arvahsu | 0:532cb55d6136 | 23 | |
arvahsu | 0:532cb55d6136 | 24 | /** This function draw the missiles onto the screen |
arvahsu | 0:532cb55d6136 | 25 | Call missile_generator() repeatedly in your game-loop. ex: main() |
arvahsu | 0:532cb55d6136 | 26 | */ |
arvahsu | 0:532cb55d6136 | 27 | void missile_generator(void); |
arvahsu | 0:532cb55d6136 | 28 | |
arvahsu | 0:532cb55d6136 | 29 | /** The function set the status of missile to be MISSILE_EXPLODED |
arvahsu | 0:532cb55d6136 | 30 | @param index The index in missile_record. It must be smaller than MAX_NUM_MISSILE. |
arvahsu | 0:532cb55d6136 | 31 | */ |
arvahsu | 0:532cb55d6136 | 32 | void missile_set_exploded(int index); |
arvahsu | 0:532cb55d6136 | 33 | |
arvahsu | 0:532cb55d6136 | 34 | /** Get the information of a missile |
arvahsu | 0:532cb55d6136 | 35 | @param index The index in missile_record. It must be smaller than MAX_NUM_MISSILE. |
arvahsu | 0:532cb55d6136 | 36 | @return The structure of missile information |
arvahsu | 0:532cb55d6136 | 37 | */ |
arvahsu | 0:532cb55d6136 | 38 | MISSILE missile_get_info(int index); |
arvahsu | 0:532cb55d6136 | 39 | |
arvahsu | 0:532cb55d6136 | 40 | /** Set the speed of missiles, Speed has range of 1-8 with 1 being fastest and 8 being slowest |
arvahsu | 0:532cb55d6136 | 41 | */ |
arvahsu | 0:532cb55d6136 | 42 | void set_missile_speed(int speed); |
arvahsu | 0:532cb55d6136 | 43 | |
arvahsu | 0:532cb55d6136 | 44 | /** Set the interval that the missiles fire, interval has range of 1-100 with 1 being fired in |
arvahsu | 0:532cb55d6136 | 45 | very quick succession and 100 being fired very slowly after one another |
arvahsu | 0:532cb55d6136 | 46 | */ |
arvahsu | 0:532cb55d6136 | 47 | void set_missile_interval(int interval); |
arvahsu | 0:532cb55d6136 | 48 | |
ajindia6 | 2:eba4ed0263a4 | 49 | void missile_draw(MISSILE missile, int color); |
ajindia6 | 2:eba4ed0263a4 | 50 | |
arvahsu | 0:532cb55d6136 | 51 | #endif //MISSILE_PUBLIC_H |