Sizhe Lin / Mbed 2 deprecated missile_command_Sizhe_Lin

Dependencies:   4DGL-uLCD-SE SDFileSystem mbed wave_player

Fork of missile_command by ECE 2035 TA

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers player.h Source File

player.h

00001 /* Gatech ECE2035 2014 FALL missile command
00002  * Copyright (c) 2014 Gatech ECE2035
00003  *
00004  * Permission is hereby granted, free of charge, to any person obtaining a copy
00005  * of this software and associated documentation files (the "Software"), to deal
00006  * in the Software without restriction, including without limitation the rights
00007  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
00008  * copies of the Software, and to permit persons to whom the Software is
00009  * furnished to do so, subject to the following conditions:
00010  *
00011  * The above copyright notice and this permission notice shall be included in
00012  * all copies or substantial portions of the Software.
00013  *
00014  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
00015  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
00016  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
00017  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
00018  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
00019  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
00020  * SOFTWARE.
00021  */
00022  
00023 // Template of player header file
00024 #ifndef PLAYER_H
00025 #define PLAYER_H
00026 
00027 // Example of some player settings
00028 #define PLAYER_WIDTH   10 
00029 #define PLAYER_HEIGHT  3
00030 #define PLAYER_DELTA   3
00031 #define PLAYER_COLOR   0x0000FF
00032 
00033 
00034 typedef enum {
00035     PLAYER_ACTIVE = 1,
00036     PLAYER_DIED = 0
00037 } PLAYER_STATUS;
00038 
00039 
00040 typedef struct {
00041     int timer;
00042     int is_active;
00043 } PROTECTOR;
00044 
00045 typedef struct {
00046     int x;// the current x of the player, bottom left
00047     int y;//current y position of the player, bottom left point
00048     int max_am;
00049     int am_remain;//how many missile for the player remain
00050     int life;//his hp remain
00051     int current_level;
00052     PLAYER_STATUS status;//if he is dead
00053     int score;//# of interceptions 
00054     int protector_num;// number of protector left
00055     PROTECTOR protector;
00056     int is_diagnoal;
00057     int angle;
00058     int timer;  
00059 } PLAYER;
00060 /** et the information of city
00061     @brief x and y are the top left corner of the player drawing
00062     @param x x-coordinate
00063     @param y y-coordinate
00064 */
00065 
00066 
00067 
00068 typedef enum {
00069     DEACTIVE = 0,
00070     ACTIVE = 1,
00071     //MISSLE_EXPLODE = 2
00072 } ANTIMISSLE_STATUS;
00073 
00074 typedef struct {
00075     int x;
00076     int y;
00077     int speed;
00078     int tick; //anti missile's internal clock
00079     ANTIMISSLE_STATUS status;
00080     int is_diagnoal;
00081     int angle;
00082 }  ANTIMISSILE;
00083 
00084 typedef enum{
00085     YES = 1,
00086     NO = 0    
00087 } EXPLOSION_STATUS;
00088 
00089 typedef struct{
00090     int x;
00091     int y;
00092     int tick;
00093     int radius;
00094     EXPLOSION_STATUS exploded;
00095     int color;
00096 } EXPLOSION;
00097     
00098 
00099 //initialize the player for the game
00100 void player_init();
00101 void player_draw();
00102 void player_move_left();
00103 void player_move_right();
00104 void antimissile_init();
00105 void shoot();
00106 void update_antimissile_positions();
00107 void draw_antimissiles();
00108 void explosion_init();
00109 void update_explosion();
00110 void draw_explosion();
00111 void update_protector();// update protector status and draw it on the screen
00112 void big_shoot();//shoot all remaining antimissile at random position
00113 
00114 //extern PLAYER current_player;
00115 //extern ANTIMISSILE am[5];
00116 //extern EXPLOSION ex[5];
00117 /**
00118 get the currrent player info
00119 */
00120 PLAYER get_player_info();
00121 #endif //PLAYER_H