Nemesis game, engine
Engine.h@6:cae24a40ab34, 2017-04-02 (annotated)
- Committer:
- musallambseiso
- Date:
- Sun Apr 02 17:47:21 2017 +0000
- Revision:
- 6:cae24a40ab34
- Parent:
- 5:88886c1bd2c1
- Child:
- 7:4c19433600c8
Added framework for bullet, still minimal progress
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 | 4:e84724dcad49 | 12 | #include "Friendly.h" |
musallambseiso | 6:cae24a40ab34 | 13 | #include "Bullet.h" |
musallambseiso | 4:e84724dcad49 | 14 | |
musallambseiso | 4:e84724dcad49 | 15 | // gap from edge of screen |
musallambseiso | 4:e84724dcad49 | 16 | #define GAP 2 |
musallambseiso | 4:e84724dcad49 | 17 | |
musallambseiso | 4:e84724dcad49 | 18 | class Engine |
musallambseiso | 4:e84724dcad49 | 19 | { |
musallambseiso | 4:e84724dcad49 | 20 | |
musallambseiso | 4:e84724dcad49 | 21 | public: |
musallambseiso | 4:e84724dcad49 | 22 | Engine(); |
musallambseiso | 4:e84724dcad49 | 23 | ~Engine(); |
musallambseiso | 4:e84724dcad49 | 24 | |
musallambseiso | 6:cae24a40ab34 | 25 | void init(int friendly_width,int friendly_height,int ship_size,int speed,N5110 &lcd, Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 26 | void read_input(Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 27 | void update(N5110 &lcd, Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 28 | void draw(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 29 | void ship1_gen(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 30 | void ship2_gen(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 31 | void ship3_gen(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 32 | void ship4_gen(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 33 | void ship5_gen(N5110 &lcd); |
musallambseiso | 6:cae24a40ab34 | 34 | void bullet_gen(N5110 &lcd); |
musallambseiso | 4:e84724dcad49 | 35 | |
musallambseiso | 4:e84724dcad49 | 36 | private: |
musallambseiso | 4:e84724dcad49 | 37 | |
musallambseiso | 4:e84724dcad49 | 38 | void check_wall_collision(Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 39 | void check_friendly_collisions(Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 40 | void check_pass(Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 41 | void check_death1(N5110 &lcd, Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 42 | void check_death2(N5110 &lcd, Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 43 | void check_death3(N5110 &lcd, Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 44 | void check_death4(N5110 &lcd, Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 45 | void check_death5(N5110 &lcd, Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 46 | void check_death(N5110 &lcd, Gamepad &pad); |
musallambseiso | 5:88886c1bd2c1 | 47 | void death(Gamepad &pad); |
musallambseiso | 4:e84724dcad49 | 48 | |
musallambseiso | 4:e84724dcad49 | 49 | Friendly _friendly; |
musallambseiso | 4:e84724dcad49 | 50 | |
musallambseiso | 4:e84724dcad49 | 51 | int _friendly_width; |
musallambseiso | 4:e84724dcad49 | 52 | int _friendly_height; |
musallambseiso | 4:e84724dcad49 | 53 | int _ship_size; |
musallambseiso | 4:e84724dcad49 | 54 | int _speed; |
musallambseiso | 4:e84724dcad49 | 55 | |
musallambseiso | 4:e84724dcad49 | 56 | int _friendlyx; |
musallambseiso | 4:e84724dcad49 | 57 | |
musallambseiso | 4:e84724dcad49 | 58 | Ship1 _ship1; |
musallambseiso | 4:e84724dcad49 | 59 | Ship2 _ship2; |
musallambseiso | 4:e84724dcad49 | 60 | Ship3 _ship3; |
musallambseiso | 4:e84724dcad49 | 61 | Ship4 _ship4; |
musallambseiso | 4:e84724dcad49 | 62 | Ship5 _ship5; |
musallambseiso | 6:cae24a40ab34 | 63 | Bullet _bullet; |
musallambseiso | 4:e84724dcad49 | 64 | |
musallambseiso | 4:e84724dcad49 | 65 | Direction _d; |
musallambseiso | 4:e84724dcad49 | 66 | float _mag; |
musallambseiso | 4:e84724dcad49 | 67 | |
musallambseiso | 4:e84724dcad49 | 68 | }; |
musallambseiso | 4:e84724dcad49 | 69 | |
musallambseiso | 4:e84724dcad49 | 70 | #endif |