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