Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed
SpaceInvaderEngine/SpaceInvaderEngine.h@23:aa86e32b6a74, 2020-05-14 (annotated)
- Committer:
- josh_ohara
- Date:
- Thu May 14 08:33:06 2020 +0000
- Revision:
- 23:aa86e32b6a74
- Parent:
- 22:3e978b1d7958
- Child:
- 24:ff5af5a013b5
Main game completed. Now to add difficulty selection and difficulty progression as a function of level
Who changed what in which revision?
| User | Revision | Line number | New contents of line |
|---|---|---|---|
| josh_ohara | 6:5bea67cc96f9 | 1 | #ifndef SPACEINVADERENGINE_H |
| josh_ohara | 6:5bea67cc96f9 | 2 | #define SPACEINVADERENGINE_H |
| josh_ohara | 6:5bea67cc96f9 | 3 | |
| josh_ohara | 6:5bea67cc96f9 | 4 | #include "mbed.h" |
| josh_ohara | 6:5bea67cc96f9 | 5 | #include "N5110.h" |
| josh_ohara | 6:5bea67cc96f9 | 6 | #include "Gamepad.h" |
| josh_ohara | 6:5bea67cc96f9 | 7 | #include "Ship.h" |
| josh_ohara | 12:be491ab6e742 | 8 | #include "Armada.h" |
| josh_ohara | 15:dde4ce4bf7fe | 9 | #include "Cover.h" |
| josh_ohara | 11:c174d84e4866 | 10 | #include <vector> |
| josh_ohara | 6:5bea67cc96f9 | 11 | |
| josh_ohara | 6:5bea67cc96f9 | 12 | #define BORDER 2 |
| josh_ohara | 6:5bea67cc96f9 | 13 | |
| josh_ohara | 6:5bea67cc96f9 | 14 | class SpaceInvaderEngine |
| josh_ohara | 6:5bea67cc96f9 | 15 | { |
| josh_ohara | 6:5bea67cc96f9 | 16 | |
| josh_ohara | 6:5bea67cc96f9 | 17 | public: |
| josh_ohara | 6:5bea67cc96f9 | 18 | SpaceInvaderEngine(); |
| josh_ohara | 8:86cb9a9f8a73 | 19 | ~SpaceInvaderEngine(); |
| josh_ohara | 15:dde4ce4bf7fe | 20 | void init(int ship_height, int ship_width, int alien_size, int no_aliens, int armada_column_size, int armada_row_size, int cover_y, int cover1_x, int cover2_x, int cover3_x, int no_rocks); |
| josh_ohara | 6:5bea67cc96f9 | 21 | void read_input(Gamepad &pad); |
| josh_ohara | 16:987f72d9bb8f | 22 | void update(Gamepad &pad, N5110 &lcd, int counter); |
| josh_ohara | 8:86cb9a9f8a73 | 23 | void render(N5110 &lcd); |
| josh_ohara | 11:c174d84e4866 | 24 | void shoot_bullet(); |
| josh_ohara | 14:e88bcf5c0887 | 25 | void get_ship_pos(); |
| josh_ohara | 14:e88bcf5c0887 | 26 | void ship_bullet_alien_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 15:dde4ce4bf7fe | 27 | void ship_bullet_cover1_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 15:dde4ce4bf7fe | 28 | void ship_bullet_cover2_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 15:dde4ce4bf7fe | 29 | void ship_bullet_cover3_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 20:0b6f1cfc5be6 | 30 | void alien_bullet_ship_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 20:0b6f1cfc5be6 | 31 | void alien_bullet_cover3_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 20:0b6f1cfc5be6 | 32 | void alien_bullet_cover1_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 20:0b6f1cfc5be6 | 33 | void alien_bullet_cover2_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 21:970807533b10 | 34 | void alien_ship_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 21:970807533b10 | 35 | void alien_cover1_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 21:970807533b10 | 36 | void alien_cover2_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 21:970807533b10 | 37 | void alien_cover3_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 22:3e978b1d7958 | 38 | bool get_armada_life(); |
| josh_ohara | 22:3e978b1d7958 | 39 | bool get_ship_life(); |
| josh_ohara | 23:aa86e32b6a74 | 40 | void kill_all(); |
| josh_ohara | 14:e88bcf5c0887 | 41 | |
| josh_ohara | 6:5bea67cc96f9 | 42 | private: |
| josh_ohara | 6:5bea67cc96f9 | 43 | |
| josh_ohara | 12:be491ab6e742 | 44 | Armada A1; |
| josh_ohara | 6:5bea67cc96f9 | 45 | Ship S1; |
| josh_ohara | 11:c174d84e4866 | 46 | BulletS BS1; |
| josh_ohara | 15:dde4ce4bf7fe | 47 | Cover C1; |
| josh_ohara | 15:dde4ce4bf7fe | 48 | Cover C2; |
| josh_ohara | 15:dde4ce4bf7fe | 49 | Cover C3; |
| josh_ohara | 6:5bea67cc96f9 | 50 | |
| josh_ohara | 6:5bea67cc96f9 | 51 | int S1_height; |
| josh_ohara | 6:5bea67cc96f9 | 52 | int S1_width; |
| josh_ohara | 9:8e695df3cc36 | 53 | int A1_size; |
| josh_ohara | 12:be491ab6e742 | 54 | int N; |
| josh_ohara | 12:be491ab6e742 | 55 | int CS; |
| josh_ohara | 12:be491ab6e742 | 56 | int RS; |
| josh_ohara | 6:5bea67cc96f9 | 57 | |
| josh_ohara | 9:8e695df3cc36 | 58 | int A1y; |
| josh_ohara | 14:e88bcf5c0887 | 59 | int S1x; |
| josh_ohara | 14:e88bcf5c0887 | 60 | int S1y; |
| josh_ohara | 15:dde4ce4bf7fe | 61 | int Cy; |
| josh_ohara | 15:dde4ce4bf7fe | 62 | int C1x; |
| josh_ohara | 15:dde4ce4bf7fe | 63 | int C2x; |
| josh_ohara | 15:dde4ce4bf7fe | 64 | int C3x; |
| josh_ohara | 15:dde4ce4bf7fe | 65 | int NR; |
| josh_ohara | 6:5bea67cc96f9 | 66 | |
| josh_ohara | 12:be491ab6e742 | 67 | |
| josh_ohara | 6:5bea67cc96f9 | 68 | Direction D; |
| josh_ohara | 6:5bea67cc96f9 | 69 | float Mag; |
| josh_ohara | 6:5bea67cc96f9 | 70 | |
| josh_ohara | 6:5bea67cc96f9 | 71 | }; |
| josh_ohara | 6:5bea67cc96f9 | 72 | |
| josh_ohara | 6:5bea67cc96f9 | 73 | #endif |