harry rance
/
Revised_Space_Invaders
Harry Rance 200925395 Embedded Systems Project
GameEngine.h@2:50feb42b982c, 2017-04-26 (annotated)
- Committer:
- harryrance
- Date:
- Wed Apr 26 17:40:17 2017 +0000
- Revision:
- 2:50feb42b982c
- Parent:
- 1:95d7dd44bb0d
- Child:
- 3:43970d8d642e
Game engine complete. Boss fight implemented (very hard!) and end game screen characteristics change depending on whether you defeated the boss or the boss defeated you.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
harryrance | 0:c9bf674fe0c7 | 1 | #ifndef GAMEENGINE_H |
harryrance | 0:c9bf674fe0c7 | 2 | #define GAMEENGINE_H |
harryrance | 0:c9bf674fe0c7 | 3 | |
harryrance | 0:c9bf674fe0c7 | 4 | #include "mbed.h" |
harryrance | 0:c9bf674fe0c7 | 5 | #include "N5110.h" |
harryrance | 0:c9bf674fe0c7 | 6 | #include "Gamepad.h" |
harryrance | 2:50feb42b982c | 7 | #include "Boss.h" |
harryrance | 0:c9bf674fe0c7 | 8 | #include "UserShip.h" |
harryrance | 0:c9bf674fe0c7 | 9 | #include "AliensArray.h" |
harryrance | 1:95d7dd44bb0d | 10 | #include "Bullet.h" |
harryrance | 0:c9bf674fe0c7 | 11 | |
harryrance | 0:c9bf674fe0c7 | 12 | class GameEngine |
harryrance | 0:c9bf674fe0c7 | 13 | { |
harryrance | 0:c9bf674fe0c7 | 14 | public: |
harryrance | 0:c9bf674fe0c7 | 15 | GameEngine(); |
harryrance | 0:c9bf674fe0c7 | 16 | ~GameEngine(); |
harryrance | 2:50feb42b982c | 17 | void initialise(int ship_x_origin, int alien_x_origin, int speed); |
harryrance | 0:c9bf674fe0c7 | 18 | void read_input(Gamepad &pad); |
harryrance | 0:c9bf674fe0c7 | 19 | void update(Gamepad &pad); |
harryrance | 0:c9bf674fe0c7 | 20 | void draw(N5110 &lcd); |
harryrance | 0:c9bf674fe0c7 | 21 | |
harryrance | 0:c9bf674fe0c7 | 22 | private: |
harryrance | 0:c9bf674fe0c7 | 23 | void check_alien_wall_collision(Gamepad &pad); |
harryrance | 0:c9bf674fe0c7 | 24 | void check_end_game(N5110 &lcd); |
harryrance | 1:95d7dd44bb0d | 25 | void set_bullet_position(Gamepad &pad); |
harryrance | 2:50feb42b982c | 26 | void check_bullet_alien_collision(Gamepad &pad); |
harryrance | 2:50feb42b982c | 27 | void eliminate_alien_line_0(); |
harryrance | 2:50feb42b982c | 28 | void eliminate_alien_line_1(); |
harryrance | 2:50feb42b982c | 29 | void eliminate_alien_line_1_1(); |
harryrance | 2:50feb42b982c | 30 | void reset_bullet(); |
harryrance | 2:50feb42b982c | 31 | void reset_bullet_for_boss(); |
harryrance | 2:50feb42b982c | 32 | void print_score_coins(N5110 &lcd); |
harryrance | 2:50feb42b982c | 33 | void move_boss(Gamepad &pad); |
harryrance | 2:50feb42b982c | 34 | void boss_fight_health_bar(N5110 &lcd); |
harryrance | 2:50feb42b982c | 35 | void check_fight_complete(N5110 &lcd); |
harryrance | 2:50feb42b982c | 36 | void check_bomb_ship_collision(Gamepad &pad); |
harryrance | 2:50feb42b982c | 37 | void end_game(N5110 &lcd); |
harryrance | 0:c9bf674fe0c7 | 38 | |
harryrance | 0:c9bf674fe0c7 | 39 | int _us_x_origin; |
harryrance | 0:c9bf674fe0c7 | 40 | int _aa_x_origin; |
harryrance | 0:c9bf674fe0c7 | 41 | int _x; |
harryrance | 0:c9bf674fe0c7 | 42 | int _xa; |
harryrance | 0:c9bf674fe0c7 | 43 | int _speed; |
harryrance | 2:50feb42b982c | 44 | int _set_bullet_x; |
harryrance | 2:50feb42b982c | 45 | int _boss_check; |
harryrance | 2:50feb42b982c | 46 | int _end_game_const; |
harryrance | 0:c9bf674fe0c7 | 47 | |
harryrance | 2:50feb42b982c | 48 | Boss _boss; |
harryrance | 1:95d7dd44bb0d | 49 | Bullet _bullet; |
harryrance | 0:c9bf674fe0c7 | 50 | AliensArray _aliens; |
harryrance | 0:c9bf674fe0c7 | 51 | UserShip _ship; |
harryrance | 0:c9bf674fe0c7 | 52 | |
harryrance | 0:c9bf674fe0c7 | 53 | Direction _d; |
harryrance | 0:c9bf674fe0c7 | 54 | float _mag; |
harryrance | 0:c9bf674fe0c7 | 55 | }; |
harryrance | 0:c9bf674fe0c7 | 56 | |
harryrance | 0:c9bf674fe0c7 | 57 | #endif |
harryrance | 0:c9bf674fe0c7 | 58 |