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
test
enemy.h@33:d17d71103d41, 2021-04-29 (annotated)
- 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?
User | Revision | Line number | New contents of line |
---|---|---|---|
michaeljson | 0:3817adfaeb06 | 1 | #ifndef ENEMY_H |
michaeljson | 0:3817adfaeb06 | 2 | #define ENEMY_H |
michaeljson | 0:3817adfaeb06 | 3 | |
michaeljson | 0:3817adfaeb06 | 4 | #include "mbed.h" |
michaeljson | 0:3817adfaeb06 | 5 | #include "enemy.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 | // Enemy Status |
michaeljson | 0:3817adfaeb06 | 12 | typedef enum { |
michaeljson | 0:3817adfaeb06 | 13 | ENEMY_DEAD = 0, |
michaeljson | 0:3817adfaeb06 | 14 | ENEMY_ALIVE = 1 |
michaeljson | 0:3817adfaeb06 | 15 | } ENEMY_STATUS; |
michaeljson | 0:3817adfaeb06 | 16 | |
michaeljson | 0:3817adfaeb06 | 17 | /// This struct contains the status of a enemy |
michaeljson | 0:3817adfaeb06 | 18 | typedef struct |
michaeljson | 0:3817adfaeb06 | 19 | { |
michaeljson | 0:3817adfaeb06 | 20 | int enemy_blk_x; ///< horizontal position in the grid |
michaeljson | 0:3817adfaeb06 | 21 | int enemy_blk_y; ///< vertical position in the grid |
michaeljson | 0:3817adfaeb06 | 22 | int enemy_old_blk_x; ///< old horizontal position in the grid |
michaeljson | 0:3817adfaeb06 | 23 | int enemy_old_blk_y; ///< old vertical position in the grid |
michaeljson | 0:3817adfaeb06 | 24 | int enemy_width; |
michaeljson | 0:3817adfaeb06 | 25 | int enemy_height; |
michaeljson | 0:3817adfaeb06 | 26 | int enemy_color; ///< color of the enemy |
michaeljson | 0:3817adfaeb06 | 27 | ENEMY_STATUS status; |
michaeljson | 0:3817adfaeb06 | 28 | } enemy_t; |
michaeljson | 0:3817adfaeb06 | 29 | |
michaeljson | 0:3817adfaeb06 | 30 | void enemy_init(enemy_t * g, unsigned int blk_x, unsigned int blk_y, unsigned int color); |
michaeljson | 0:3817adfaeb06 | 31 | void enemy_show(enemy_t *g); |
michaeljson | 0:3817adfaeb06 | 32 | void enemy_erase(enemy_t *g); |
michaeljson | 0:3817adfaeb06 | 33 | int check_enemy(enemy_t *g, missile_t *h); |
michaeljson | 0:3817adfaeb06 | 34 | int move_enemy(enemy_t *g, int MOVE_DOWN, int DIRECTION); |
michaeljson | 0:3817adfaeb06 | 35 | |
michaeljson | 0:3817adfaeb06 | 36 | #endif //ENEMY_H |