deemo1

Dependencies:   mbed

Committer:
haoyan
Date:
Tue May 12 15:13:22 2020 +0000
Revision:
3:1db91ad3ab84
Parent:
1:8c48fb8ca5e0
Child:
4:9fa0c5edd1a1
finish2

Who changed what in which revision?

UserRevisionLine numberNew 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 1:8c48fb8ca5e0 11
haoyan 1:8c48fb8ca5e0 12 // gap from edge of screen
haoyan 1:8c48fb8ca5e0 13 #define GAP 2
haoyan 1:8c48fb8ca5e0 14
haoyan 1:8c48fb8ca5e0 15 /** StarcraftEngine Class
haoyan 1:8c48fb8ca5e0 16 @brief StarcraftEngine
haoyan 1:8c48fb8ca5e0 17 @author Haoyan Zhang
haoyan 1:8c48fb8ca5e0 18 @date May, 2020
haoyan 1:8c48fb8ca5e0 19 */
haoyan 1:8c48fb8ca5e0 20
haoyan 1:8c48fb8ca5e0 21
haoyan 1:8c48fb8ca5e0 22 class StarcraftEngine
haoyan 1:8c48fb8ca5e0 23 {
haoyan 1:8c48fb8ca5e0 24
haoyan 1:8c48fb8ca5e0 25 public:
haoyan 1:8c48fb8ca5e0 26 StarcraftEngine();
haoyan 1:8c48fb8ca5e0 27 ~StarcraftEngine();
haoyan 1:8c48fb8ca5e0 28
haoyan 3:1db91ad3ab84 29 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 speed);
haoyan 1:8c48fb8ca5e0 30 void read_input(Gamepad &pad);
haoyan 1:8c48fb8ca5e0 31 int find_life();
haoyan 1:8c48fb8ca5e0 32 int find_score();
haoyan 1:8c48fb8ca5e0 33 void draw(N5110 &lcd);
haoyan 1:8c48fb8ca5e0 34 void update(Gamepad &pad);
haoyan 1:8c48fb8ca5e0 35
haoyan 1:8c48fb8ca5e0 36 private:
haoyan 1:8c48fb8ca5e0 37 void check_Swarm_collisions(Gamepad &pad);
haoyan 3:1db91ad3ab84 38 void check_Boss_collisions(Gamepad &pad);
haoyan 1:8c48fb8ca5e0 39 void check_goal(Gamepad &pad);
haoyan 1:8c48fb8ca5e0 40 void print_scores(N5110 &lcd);
haoyan 1:8c48fb8ca5e0 41
haoyan 1:8c48fb8ca5e0 42 Battleship _Battleship;
haoyan 1:8c48fb8ca5e0 43 int _Battleship_height;
haoyan 1:8c48fb8ca5e0 44 int _Battleship_width;
haoyan 1:8c48fb8ca5e0 45 int _speed;
haoyan 1:8c48fb8ca5e0 46 // x positions of the Battleship
haoyan 1:8c48fb8ca5e0 47 int _Battleshipx;
haoyan 1:8c48fb8ca5e0 48
haoyan 1:8c48fb8ca5e0 49
haoyan 1:8c48fb8ca5e0 50 Laser _Laser;
haoyan 1:8c48fb8ca5e0 51 int _Laser_height;
haoyan 1:8c48fb8ca5e0 52 int _Laser_width;
haoyan 1:8c48fb8ca5e0 53
haoyan 1:8c48fb8ca5e0 54 Swarm _Swarm;
haoyan 1:8c48fb8ca5e0 55 int _Swarm_height;
haoyan 1:8c48fb8ca5e0 56 int _Swarm_width;
haoyan 1:8c48fb8ca5e0 57
haoyan 3:1db91ad3ab84 58 Boss _Boss;
haoyan 3:1db91ad3ab84 59 int _Boss_height;
haoyan 3:1db91ad3ab84 60 int _Boss_width;
haoyan 3:1db91ad3ab84 61
haoyan 1:8c48fb8ca5e0 62 Direction _d;
haoyan 1:8c48fb8ca5e0 63 float _mag;
haoyan 1:8c48fb8ca5e0 64 };
haoyan 1:8c48fb8ca5e0 65 #endif
haoyan 1:8c48fb8ca5e0 66
haoyan 1:8c48fb8ca5e0 67
haoyan 1:8c48fb8ca5e0 68
haoyan 1:8c48fb8ca5e0 69
haoyan 1:8c48fb8ca5e0 70
haoyan 1:8c48fb8ca5e0 71
haoyan 1:8c48fb8ca5e0 72