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: 4DGL-uLCD-SE SDFileSystem mbed wave_player
Fork of missile_command by
Diff: player.h
- Revision:
- 2:d39a6a36e0c0
- Parent:
- 0:532cb55d6136
- Child:
- 4:0dc720aa3c71
--- a/player.h Wed Oct 29 02:58:53 2014 +0000
+++ b/player.h Mon Nov 17 13:15:34 2014 +0000
@@ -31,11 +31,85 @@
#define PLAYER_COLOR 0x0000FF
-/** Get the information of city
+typedef enum {
+ PLAYER_ACTIVE = 1,
+ PLAYER_DIED = 0
+} PLAYER_STATUS;
+
+
+typedef struct {
+ int timer;
+ int is_active;
+} PROTECTOR;
+
+typedef struct {
+ int x;// the current x of the player, bottom left
+ int y;//current y position of the player, bottom left point
+ int max_am;
+ int am_remain;//how many missile for the player remain
+ int life;//his hp remain
+ int current_level;
+ PLAYER_STATUS status;//if he is dead
+ int score;//# of interceptions
+ int protector_num;// number of protector left
+ PROTECTOR protector;
+} PLAYER;
+/** et the information of city
@brief x and y are the top left corner of the player drawing
@param x x-coordinate
@param y y-coordinate
*/
-void player_draw(int x, int y);
+
+
+
+typedef enum {
+ DEACTIVE = 0,
+ ACTIVE = 1,
+ //MISSLE_EXPLODE = 2
+} ANTIMISSLE_STATUS;
+
+typedef struct {
+ int x;
+ int y;
+ int speed;
+ int tick; //anti missile's internal clock
+ ANTIMISSLE_STATUS status;
+} ANTIMISSILE;
+
+typedef enum{
+ YES = 1,
+ NO = 0
+} EXPLOSION_STATUS;
+typedef struct{
+ int x;
+ int y;
+ int tick;
+ int radius;
+ EXPLOSION_STATUS exploded;
+ int color;
+} EXPLOSION;
+
+
+//initialize the player for the game
+void player_init();
+void player_draw();
+void player_move_left();
+void player_move_right();
+void antimissile_init();
+void shoot();
+void update_antimissile_positions();
+void draw_antimissiles();
+void explosion_init();
+void update_explosion();
+void draw_explosion();
+void update_protector();// update protector status and draw it on the screen
+
+//extern PLAYER current_player;
+//extern ANTIMISSILE am[5];
+//extern EXPLOSION ex[5];
+/**
+get the currrent player info
+*/
+PLAYER get_player_info();
#endif //PLAYER_H
\ No newline at end of file
