Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed wave_player 4DGL-uLCD-SE MMA8452
missile_public.h@0:09aa1ecd6c39, 2020-06-24 (annotated)
- Committer:
- lwills
- Date:
- Wed Jun 24 21:09:03 2020 +0000
- Revision:
- 0:09aa1ecd6c39
- Child:
- 1:5724f2947554
Missile Command shell
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
lwills | 0:09aa1ecd6c39 | 1 | //================================================================= |
lwills | 0:09aa1ecd6c39 | 2 | // The header file defining the missile module |
lwills | 0:09aa1ecd6c39 | 3 | // |
lwills | 0:09aa1ecd6c39 | 4 | // Copyright 2020 Georgia Tech. All rights reserved. |
lwills | 0:09aa1ecd6c39 | 5 | // The materials provided by the instructor in this course are for |
lwills | 0:09aa1ecd6c39 | 6 | // the use of the students currently enrolled in the course. |
lwills | 0:09aa1ecd6c39 | 7 | // Copyrighted course materials may not be further disseminated. |
lwills | 0:09aa1ecd6c39 | 8 | // This file must not be made publicly available anywhere. |
lwills | 0:09aa1ecd6c39 | 9 | //================================================================== |
lwills | 0:09aa1ecd6c39 | 10 | /** @file missile_public.h */ |
lwills | 0:09aa1ecd6c39 | 11 | #ifndef MISSILE_PUBLIC_H |
lwills | 0:09aa1ecd6c39 | 12 | #define MISSILE_PUBLIC_H |
lwills | 0:09aa1ecd6c39 | 13 | |
lwills | 0:09aa1ecd6c39 | 14 | #include "doubly_linked_list.h" |
lwills | 0:09aa1ecd6c39 | 15 | |
lwills | 0:09aa1ecd6c39 | 16 | typedef enum { |
lwills | 0:09aa1ecd6c39 | 17 | MISSILE_EXPLODED=0, |
lwills | 0:09aa1ecd6c39 | 18 | MISSILE_ACTIVE=1, |
lwills | 0:09aa1ecd6c39 | 19 | } MISSILE_STATUS; |
lwills | 0:09aa1ecd6c39 | 20 | |
lwills | 0:09aa1ecd6c39 | 21 | /// The structure to store the information of a missile |
lwills | 0:09aa1ecd6c39 | 22 | typedef struct { |
lwills | 0:09aa1ecd6c39 | 23 | int x; ///< The x-coordinate of missile current position |
lwills | 0:09aa1ecd6c39 | 24 | int y; ///< The y-coordinate of missile current position |
lwills | 0:09aa1ecd6c39 | 25 | double source_x; ///< The x-coordinate of the missile's origin |
lwills | 0:09aa1ecd6c39 | 26 | double target_x; ///< The x-coordinate of the missile's target |
lwills | 0:09aa1ecd6c39 | 27 | int tick; ///< The missile's internal tick |
lwills | 0:09aa1ecd6c39 | 28 | MISSILE_STATUS status; ///< The missile status, see MISSILE_STATUS |
lwills | 0:09aa1ecd6c39 | 29 | } MISSILE; |
lwills | 0:09aa1ecd6c39 | 30 | |
lwills | 0:09aa1ecd6c39 | 31 | /** Call missile_init() only once at the begining of your code */ |
lwills | 0:09aa1ecd6c39 | 32 | void missile_init(void); |
lwills | 0:09aa1ecd6c39 | 33 | |
lwills | 0:09aa1ecd6c39 | 34 | /** Call missile_init() only once at the begining of your code */ |
lwills | 0:09aa1ecd6c39 | 35 | void missile_init(void); |
lwills | 0:09aa1ecd6c39 | 36 | |
lwills | 0:09aa1ecd6c39 | 37 | /** This function draw the missiles onto the screen |
lwills | 0:09aa1ecd6c39 | 38 | Call missile_generator() repeatedly in your game-loop. ex: main() |
lwills | 0:09aa1ecd6c39 | 39 | */ |
lwills | 0:09aa1ecd6c39 | 40 | void missile_generator(void); |
lwills | 0:09aa1ecd6c39 | 41 | |
lwills | 0:09aa1ecd6c39 | 42 | /** This function will return a linked-list of all active MISSILE structures. |
lwills | 0:09aa1ecd6c39 | 43 | This can be used to modify the active missiles. Marking missiles with status |
lwills | 0:09aa1ecd6c39 | 44 | MISSILE_EXPLODED will cue their erasure from the screen and removal from the |
lwills | 0:09aa1ecd6c39 | 45 | list at the next missile_generator() call. |
lwills | 0:09aa1ecd6c39 | 46 | */ |
lwills | 0:09aa1ecd6c39 | 47 | DLinkedList* get_missile_list(); |
lwills | 0:09aa1ecd6c39 | 48 | |
lwills | 0:09aa1ecd6c39 | 49 | /** Set the speed of missiles, Speed has range of 1-8 with 1 being fastest and 8 being slowest |
lwills | 0:09aa1ecd6c39 | 50 | */ |
lwills | 0:09aa1ecd6c39 | 51 | void set_missile_speed(int speed); |
lwills | 0:09aa1ecd6c39 | 52 | |
lwills | 0:09aa1ecd6c39 | 53 | /** Set the interval that the missiles fire, interval has range of 1-100 with 1 being fired in |
lwills | 0:09aa1ecd6c39 | 54 | very quick succession and 100 being fired very slowly after one another |
lwills | 0:09aa1ecd6c39 | 55 | */ |
lwills | 0:09aa1ecd6c39 | 56 | void set_missile_interval(int interval); |
lwills | 0:09aa1ecd6c39 | 57 | |
lwills | 0:09aa1ecd6c39 | 58 | #endif //MISSILE_PUBLIC_H |