2035

Dependencies:   4DGL-uLCD-SE mbed wave_player

Fork of missile_command by ECE 2035 TA

Committer:
tianyeapply
Date:
Wed Nov 09 17:04:42 2016 +0000
Revision:
3:7e33224a6f1d
Parent:
0:532cb55d6136

        

Who changed what in which revision?

UserRevisionLine numberNew contents of line
arvahsu 0:532cb55d6136 1 /* Gatech ECE2035 2014 FALL missile command
arvahsu 0:532cb55d6136 2 * Copyright (c) 2014 Gatech ECE2035
arvahsu 0:532cb55d6136 3 *
arvahsu 0:532cb55d6136 4 * Permission is hereby granted, free of charge, to any person obtaining a copy
arvahsu 0:532cb55d6136 5 * of this software and associated documentation files (the "Software"), to deal
arvahsu 0:532cb55d6136 6 * in the Software without restriction, including without limitation the rights
arvahsu 0:532cb55d6136 7 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
arvahsu 0:532cb55d6136 8 * copies of the Software, and to permit persons to whom the Software is
arvahsu 0:532cb55d6136 9 * furnished to do so, subject to the following conditions:
arvahsu 0:532cb55d6136 10 *
arvahsu 0:532cb55d6136 11 * The above copyright notice and this permission notice shall be included in
arvahsu 0:532cb55d6136 12 * all copies or substantial portions of the Software.
arvahsu 0:532cb55d6136 13 *
arvahsu 0:532cb55d6136 14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
arvahsu 0:532cb55d6136 15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
arvahsu 0:532cb55d6136 16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
arvahsu 0:532cb55d6136 17 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
arvahsu 0:532cb55d6136 18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
arvahsu 0:532cb55d6136 19 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
arvahsu 0:532cb55d6136 20 * SOFTWARE.
arvahsu 0:532cb55d6136 21 */
arvahsu 0:532cb55d6136 22 /** @file missile_public.h */
arvahsu 0:532cb55d6136 23 #ifndef MISSILE_PUBLIC_H
arvahsu 0:532cb55d6136 24 #define MISSILE_PUBLIC_H
arvahsu 0:532cb55d6136 25
arvahsu 0:532cb55d6136 26 ///The missile status
arvahsu 0:532cb55d6136 27 typedef enum {
arvahsu 0:532cb55d6136 28 MISSILE_EXPLODED=2,///<missile has been destroyed
arvahsu 0:532cb55d6136 29 MISSILE_ACTIVE=1,///<missile is active
arvahsu 0:532cb55d6136 30 MISSILE_DEACTIVE=0///<missile is no longer active
arvahsu 0:532cb55d6136 31 } MISSILE_STATUS;
arvahsu 0:532cb55d6136 32
arvahsu 0:532cb55d6136 33 /// The structure to store the information of a missile
arvahsu 0:532cb55d6136 34 typedef struct {
arvahsu 0:532cb55d6136 35 int x; ///< The x-coordinate of missile current position
arvahsu 0:532cb55d6136 36 int y; ///< The y-coordinate of missile current position
arvahsu 0:532cb55d6136 37 double source_x; ///< The x-coordinate of the missile's origin
arvahsu 0:532cb55d6136 38 double target_x; ///< The x-coordinate of the missile's target
tianyeapply 3:7e33224a6f1d 39 double source_y;
tianyeapply 3:7e33224a6f1d 40 double target_y;
arvahsu 0:532cb55d6136 41 int tick; ///< The missile's internal tick
arvahsu 0:532cb55d6136 42 MISSILE_STATUS status; ///< The missile status, see MISSILE_STATUS
arvahsu 0:532cb55d6136 43 } MISSILE;
arvahsu 0:532cb55d6136 44
arvahsu 0:532cb55d6136 45 #define MAX_NUM_MISSILE 5
arvahsu 0:532cb55d6136 46
arvahsu 0:532cb55d6136 47 /** This function draw the missiles onto the screen
arvahsu 0:532cb55d6136 48 Call missile_generator() repeatedly in your game-loop. ex: main()
arvahsu 0:532cb55d6136 49 */
arvahsu 0:532cb55d6136 50 void missile_generator(void);
arvahsu 0:532cb55d6136 51
arvahsu 0:532cb55d6136 52 /** The function set the status of missile to be MISSILE_EXPLODED
arvahsu 0:532cb55d6136 53 @param index The index in missile_record. It must be smaller than MAX_NUM_MISSILE.
arvahsu 0:532cb55d6136 54 */
arvahsu 0:532cb55d6136 55 void missile_set_exploded(int index);
arvahsu 0:532cb55d6136 56
arvahsu 0:532cb55d6136 57 /** Get the information of a missile
arvahsu 0:532cb55d6136 58 @param index The index in missile_record. It must be smaller than MAX_NUM_MISSILE.
arvahsu 0:532cb55d6136 59 @return The structure of missile information
arvahsu 0:532cb55d6136 60 */
arvahsu 0:532cb55d6136 61 MISSILE missile_get_info(int index);
arvahsu 0:532cb55d6136 62
arvahsu 0:532cb55d6136 63 /** Set the speed of missiles, Speed has range of 1-8 with 1 being fastest and 8 being slowest
arvahsu 0:532cb55d6136 64 */
arvahsu 0:532cb55d6136 65 void set_missile_speed(int speed);
arvahsu 0:532cb55d6136 66
arvahsu 0:532cb55d6136 67 /** Set the interval that the missiles fire, interval has range of 1-100 with 1 being fired in
arvahsu 0:532cb55d6136 68 very quick succession and 100 being fired very slowly after one another
arvahsu 0:532cb55d6136 69 */
arvahsu 0:532cb55d6136 70 void set_missile_interval(int interval);
arvahsu 0:532cb55d6136 71
tianyeapply 3:7e33224a6f1d 72 void missile_clear(MISSILE missile);
tianyeapply 3:7e33224a6f1d 73 void missile_update_position();
tianyeapply 3:7e33224a6f1d 74
tianyeapply 3:7e33224a6f1d 75
arvahsu 0:532cb55d6136 76 #endif //MISSILE_PUBLIC_H