Updated Space Invaders on the mbed. Improved upon Michael Son's "Mbed Space Invaders" at https://os.mbed.com/users/michaeljson/notebook/mbed-space-invaders/.

Dependencies:   mbed wave_player mbed-rtos 4DGL-uLCD-SE SparkfunAnalogJoystick SDFileSystem LSM9DS1_Library_cal_updated

Fork of Two-PlayerSpaceInvaders by William Minix

test

Committer:
wminix3
Date:
Thu Apr 29 05:41:40 2021 +0000
Revision:
33:d17d71103d41
Parent:
0:3817adfaeb06
Fixed score.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
michaeljson 0:3817adfaeb06 1 #ifndef PLAYER_H
michaeljson 0:3817adfaeb06 2 #define PLAYER_H
michaeljson 0:3817adfaeb06 3
michaeljson 0:3817adfaeb06 4 #include "mbed.h"
michaeljson 0:3817adfaeb06 5 #include "player.h"
michaeljson 0:3817adfaeb06 6 #include "missile.h"
michaeljson 0:3817adfaeb06 7 #include "globals.h"
michaeljson 0:3817adfaeb06 8
michaeljson 0:3817adfaeb06 9 extern uLCD_4DGL uLCD;
michaeljson 0:3817adfaeb06 10
michaeljson 0:3817adfaeb06 11 typedef enum {
michaeljson 0:3817adfaeb06 12 PLAYER_DEAD = 0,
michaeljson 0:3817adfaeb06 13 PLAYER_ALIVE = 1
michaeljson 0:3817adfaeb06 14 } PLAYER_STATUS;
michaeljson 0:3817adfaeb06 15
michaeljson 0:3817adfaeb06 16 /// This struct contains the status of a player
michaeljson 0:3817adfaeb06 17 typedef struct
michaeljson 0:3817adfaeb06 18 {
michaeljson 0:3817adfaeb06 19 int player_blk_x; ///< horizontal position in the grid
michaeljson 0:3817adfaeb06 20 int player_blk_y; ///< vertical position in the grid
michaeljson 0:3817adfaeb06 21 unsigned int player_old_blk_x; ///< old horizontal position in the grid
michaeljson 0:3817adfaeb06 22 unsigned int player_old_blk_y; ///< old vertical position in the grid
michaeljson 0:3817adfaeb06 23 int player_width;
michaeljson 0:3817adfaeb06 24 int player_height;
michaeljson 0:3817adfaeb06 25 int player_color; ///< color of the player
michaeljson 0:3817adfaeb06 26 PLAYER_STATUS status;
michaeljson 0:3817adfaeb06 27 } player_t;
michaeljson 0:3817adfaeb06 28
michaeljson 0:3817adfaeb06 29 void player_init(player_t * g, int blk_x, int blk_y, int color);
michaeljson 0:3817adfaeb06 30 void player_show(player_t *g);
michaeljson 0:3817adfaeb06 31 void player_erase(player_t *g);
michaeljson 0:3817adfaeb06 32 int check_player(player_t *g, missile_t *h);
michaeljson 0:3817adfaeb06 33 #endif //PLAYER_H