Nemesis game, engine
Engine.h@11:10c01766f774, 2017-05-01 (annotated)
- Committer:
- musallambseiso
- Date:
- Mon May 01 13:01:57 2017 +0000
- Revision:
- 11:10c01766f774
- Parent:
- 10:b2dd5f484f98
- Child:
- 12:d68c757d829a
Tidied code, added levels, fixed and improved bullet system, added enemy death sequence
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
musallambseiso | 4:e84724dcad49 | 1 | #ifndef ENGINE_H |
musallambseiso | 4:e84724dcad49 | 2 | #define ENGINE_H |
musallambseiso | 4:e84724dcad49 | 3 | |
musallambseiso | 4:e84724dcad49 | 4 | #include "mbed.h" |
musallambseiso | 4:e84724dcad49 | 5 | #include "N5110.h" |
musallambseiso | 4:e84724dcad49 | 6 | #include "Gamepad.h" |
musallambseiso | 4:e84724dcad49 | 7 | #include "Ship1.h" |
musallambseiso | 4:e84724dcad49 | 8 | #include "Ship2.h" |
musallambseiso | 4:e84724dcad49 | 9 | #include "Ship3.h" |
musallambseiso | 4:e84724dcad49 | 10 | #include "Ship4.h" |
musallambseiso | 4:e84724dcad49 | 11 | #include "Ship5.h" |
musallambseiso | 7:4c19433600c8 | 12 | #include "Ship6.h" |
musallambseiso | 4:e84724dcad49 | 13 | #include "Friendly.h" |
musallambseiso | 6:cae24a40ab34 | 14 | #include "Bullet.h" |
musallambseiso | 7:4c19433600c8 | 15 | #include "Stats.h" |
musallambseiso | 4:e84724dcad49 | 16 | |
musallambseiso | 4:e84724dcad49 | 17 | // gap from edge of screen |
musallambseiso | 4:e84724dcad49 | 18 | #define GAP 2 |
musallambseiso | 4:e84724dcad49 | 19 | |
musallambseiso | 4:e84724dcad49 | 20 | class Engine |
musallambseiso | 4:e84724dcad49 | 21 | { |
musallambseiso | 4:e84724dcad49 | 22 | |
musallambseiso | 4:e84724dcad49 | 23 | public: |
musallambseiso | 4:e84724dcad49 | 24 | Engine(); |
musallambseiso | 4:e84724dcad49 | 25 | ~Engine(); |
musallambseiso | 7:4c19433600c8 | 26 | |
musallambseiso | 8:1c0bc1a08153 | 27 | int collisions; |
musallambseiso | 9:0efc8d7cdcf7 | 28 | int wave_counter; |
musallambseiso | 11:10c01766f774 | 29 | int ammo; |
musallambseiso | 11:10c01766f774 | 30 | bool trigger; |
musallambseiso | 11:10c01766f774 | 31 | int _x; |
musallambseiso | 11:10c01766f774 | 32 | int _y; |
musallambseiso | 4:e84724dcad49 | 33 | |
musallambseiso | 11:10c01766f774 | 34 | void init(int speed, N5110 &lcd, Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 35 | void read_input(Gamepad &pad); |
musallambseiso | 7:4c19433600c8 | 36 | void checker(N5110 &lcd, Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 37 | void update(N5110 &lcd, Gamepad &pad); |
musallambseiso | 7:4c19433600c8 | 38 | void draw(N5110 &lcd); |
musallambseiso | 11:10c01766f774 | 39 | void shoot(N5110 &lcd, Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 40 | |
musallambseiso | 4:e84724dcad49 | 41 | private: |
musallambseiso | 9:0efc8d7cdcf7 | 42 | |
musallambseiso | 9:0efc8d7cdcf7 | 43 | void ships_draw(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 44 | void check_wall_collision(Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 45 | void check_friendly_collisions(Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 46 | void check_pass(Gamepad &pad); |
musallambseiso | 11:10c01766f774 | 47 | void check_enemy_death(Gamepad &pad); |
musallambseiso | 11:10c01766f774 | 48 | void check_death(Gamepad &pad, Vector2D ship_pos); |
musallambseiso | 11:10c01766f774 | 49 | void check_death_all(N5110 &lcd, Gamepad &pad); |
musallambseiso | 8:1c0bc1a08153 | 50 | void game_over(N5110 &lcd, Gamepad &pad); |
musallambseiso | 11:10c01766f774 | 51 | void level_two(N5110 &lcd, Gamepad &pad); |
musallambseiso | 11:10c01766f774 | 52 | void level_three(N5110 &lcd, Gamepad &pad); |
musallambseiso | 11:10c01766f774 | 53 | void level_four(N5110 &lcd, Gamepad &pad); |
musallambseiso | 11:10c01766f774 | 54 | void level_five(N5110 &lcd, Gamepad &pad); |
musallambseiso | 9:0efc8d7cdcf7 | 55 | void wave_draw(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 56 | |
musallambseiso | 4:e84724dcad49 | 57 | Friendly _friendly; |
musallambseiso | 11:10c01766f774 | 58 | |
musallambseiso | 4:e84724dcad49 | 59 | int _speed; |
musallambseiso | 11:10c01766f774 | 60 | |
musallambseiso | 8:1c0bc1a08153 | 61 | |
musallambseiso | 4:e84724dcad49 | 62 | Ship1 _ship1; |
musallambseiso | 4:e84724dcad49 | 63 | Ship2 _ship2; |
musallambseiso | 4:e84724dcad49 | 64 | Ship3 _ship3; |
musallambseiso | 4:e84724dcad49 | 65 | Ship4 _ship4; |
musallambseiso | 4:e84724dcad49 | 66 | Ship5 _ship5; |
musallambseiso | 7:4c19433600c8 | 67 | Ship6 _ship6; |
musallambseiso | 6:cae24a40ab34 | 68 | Bullet _bullet; |
musallambseiso | 7:4c19433600c8 | 69 | Stats _stats; |
musallambseiso | 4:e84724dcad49 | 70 | |
musallambseiso | 4:e84724dcad49 | 71 | Direction _d; |
musallambseiso | 4:e84724dcad49 | 72 | float _mag; |
musallambseiso | 4:e84724dcad49 | 73 | |
musallambseiso | 4:e84724dcad49 | 74 | }; |
musallambseiso | 4:e84724dcad49 | 75 | |
musallambseiso | 4:e84724dcad49 | 76 | #endif |