Haoyan Zhang
/
el17h2z1
deemo1
StarcraftEngine/StarcraftEngine.h@4:9fa0c5edd1a1, 2020-05-12 (annotated)
- Committer:
- haoyan
- Date:
- Tue May 12 15:54:51 2020 +0000
- Revision:
- 4:9fa0c5edd1a1
- Parent:
- 3:1db91ad3ab84
ok
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
haoyan | 1:8c48fb8ca5e0 | 1 | #ifndef STARCRAFTENGINE_H |
haoyan | 1:8c48fb8ca5e0 | 2 | #define STARCRAFTENGINE_H |
haoyan | 1:8c48fb8ca5e0 | 3 | |
haoyan | 1:8c48fb8ca5e0 | 4 | #include "mbed.h" |
haoyan | 1:8c48fb8ca5e0 | 5 | #include "N5110.h" |
haoyan | 1:8c48fb8ca5e0 | 6 | #include "Gamepad.h" |
haoyan | 1:8c48fb8ca5e0 | 7 | #include "Battleship.h" |
haoyan | 1:8c48fb8ca5e0 | 8 | #include "Laser.h" |
haoyan | 1:8c48fb8ca5e0 | 9 | #include "Swarm.h" |
haoyan | 3:1db91ad3ab84 | 10 | #include "Boss.h" |
haoyan | 4:9fa0c5edd1a1 | 11 | #include "Acid.h" |
haoyan | 1:8c48fb8ca5e0 | 12 | |
haoyan | 1:8c48fb8ca5e0 | 13 | // gap from edge of screen |
haoyan | 1:8c48fb8ca5e0 | 14 | #define GAP 2 |
haoyan | 1:8c48fb8ca5e0 | 15 | |
haoyan | 1:8c48fb8ca5e0 | 16 | /** StarcraftEngine Class |
haoyan | 1:8c48fb8ca5e0 | 17 | @brief StarcraftEngine |
haoyan | 1:8c48fb8ca5e0 | 18 | @author Haoyan Zhang |
haoyan | 1:8c48fb8ca5e0 | 19 | @date May, 2020 |
haoyan | 1:8c48fb8ca5e0 | 20 | */ |
haoyan | 1:8c48fb8ca5e0 | 21 | |
haoyan | 1:8c48fb8ca5e0 | 22 | |
haoyan | 1:8c48fb8ca5e0 | 23 | class StarcraftEngine |
haoyan | 1:8c48fb8ca5e0 | 24 | { |
haoyan | 1:8c48fb8ca5e0 | 25 | |
haoyan | 1:8c48fb8ca5e0 | 26 | public: |
haoyan | 1:8c48fb8ca5e0 | 27 | StarcraftEngine(); |
haoyan | 1:8c48fb8ca5e0 | 28 | ~StarcraftEngine(); |
haoyan | 1:8c48fb8ca5e0 | 29 | |
haoyan | 4:9fa0c5edd1a1 | 30 | void init(int Battleship_height, int Battleship_width, int Laser_height, int Laser_width, int Swarm_height, int Swarm_width,int Boss_height, int Boss_width, int Acid_height, int Acid_width,int speed); |
haoyan | 1:8c48fb8ca5e0 | 31 | void read_input(Gamepad &pad); |
haoyan | 1:8c48fb8ca5e0 | 32 | int find_life(); |
haoyan | 1:8c48fb8ca5e0 | 33 | int find_score(); |
haoyan | 1:8c48fb8ca5e0 | 34 | void draw(N5110 &lcd); |
haoyan | 1:8c48fb8ca5e0 | 35 | void update(Gamepad &pad); |
haoyan | 1:8c48fb8ca5e0 | 36 | |
haoyan | 1:8c48fb8ca5e0 | 37 | private: |
haoyan | 1:8c48fb8ca5e0 | 38 | void check_Swarm_collisions(Gamepad &pad); |
haoyan | 3:1db91ad3ab84 | 39 | void check_Boss_collisions(Gamepad &pad); |
haoyan | 4:9fa0c5edd1a1 | 40 | void check_Battleship_collisions(Gamepad &pad); |
haoyan | 1:8c48fb8ca5e0 | 41 | void check_goal(Gamepad &pad); |
haoyan | 1:8c48fb8ca5e0 | 42 | void print_scores(N5110 &lcd); |
haoyan | 1:8c48fb8ca5e0 | 43 | |
haoyan | 1:8c48fb8ca5e0 | 44 | Battleship _Battleship; |
haoyan | 1:8c48fb8ca5e0 | 45 | int _Battleship_height; |
haoyan | 1:8c48fb8ca5e0 | 46 | int _Battleship_width; |
haoyan | 1:8c48fb8ca5e0 | 47 | int _speed; |
haoyan | 1:8c48fb8ca5e0 | 48 | // x positions of the Battleship |
haoyan | 1:8c48fb8ca5e0 | 49 | int _Battleshipx; |
haoyan | 1:8c48fb8ca5e0 | 50 | |
haoyan | 1:8c48fb8ca5e0 | 51 | |
haoyan | 1:8c48fb8ca5e0 | 52 | Laser _Laser; |
haoyan | 1:8c48fb8ca5e0 | 53 | int _Laser_height; |
haoyan | 1:8c48fb8ca5e0 | 54 | int _Laser_width; |
haoyan | 1:8c48fb8ca5e0 | 55 | |
haoyan | 1:8c48fb8ca5e0 | 56 | Swarm _Swarm; |
haoyan | 1:8c48fb8ca5e0 | 57 | int _Swarm_height; |
haoyan | 1:8c48fb8ca5e0 | 58 | int _Swarm_width; |
haoyan | 1:8c48fb8ca5e0 | 59 | |
haoyan | 3:1db91ad3ab84 | 60 | Boss _Boss; |
haoyan | 3:1db91ad3ab84 | 61 | int _Boss_height; |
haoyan | 3:1db91ad3ab84 | 62 | int _Boss_width; |
haoyan | 3:1db91ad3ab84 | 63 | |
haoyan | 4:9fa0c5edd1a1 | 64 | Acid _Acid; |
haoyan | 4:9fa0c5edd1a1 | 65 | int _Acid_height; |
haoyan | 4:9fa0c5edd1a1 | 66 | int _Acid_width; |
haoyan | 4:9fa0c5edd1a1 | 67 | |
haoyan | 1:8c48fb8ca5e0 | 68 | Direction _d; |
haoyan | 1:8c48fb8ca5e0 | 69 | float _mag; |
haoyan | 1:8c48fb8ca5e0 | 70 | }; |
haoyan | 1:8c48fb8ca5e0 | 71 | #endif |
haoyan | 1:8c48fb8ca5e0 | 72 | |
haoyan | 1:8c48fb8ca5e0 | 73 | |
haoyan | 1:8c48fb8ca5e0 | 74 | |
haoyan | 1:8c48fb8ca5e0 | 75 | |
haoyan | 1:8c48fb8ca5e0 | 76 | |
haoyan | 1:8c48fb8ca5e0 | 77 | |
haoyan | 1:8c48fb8ca5e0 | 78 |