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@15:dde4ce4bf7fe, 2020-04-06 (annotated)
- Committer:
- josh_ohara
- Date:
- Mon Apr 06 15:37:02 2020 +0000
- Revision:
- 15:dde4ce4bf7fe
- Parent:
- 14:e88bcf5c0887
- Child:
- 16:987f72d9bb8f
Cover for ship completed. Next task is to add timeout to the ship bullet
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 | 11:c174d84e4866 | 7 | #include "BulletS.h" |
| josh_ohara | 6:5bea67cc96f9 | 8 | #include "Ship.h" |
| josh_ohara | 12:be491ab6e742 | 9 | #include "Armada.h" |
| josh_ohara | 15:dde4ce4bf7fe | 10 | #include "Cover.h" |
| josh_ohara | 11:c174d84e4866 | 11 | #include <vector> |
| josh_ohara | 6:5bea67cc96f9 | 12 | |
| josh_ohara | 6:5bea67cc96f9 | 13 | #define BORDER 2 |
| josh_ohara | 6:5bea67cc96f9 | 14 | |
| josh_ohara | 6:5bea67cc96f9 | 15 | class SpaceInvaderEngine |
| josh_ohara | 6:5bea67cc96f9 | 16 | { |
| josh_ohara | 6:5bea67cc96f9 | 17 | |
| josh_ohara | 6:5bea67cc96f9 | 18 | public: |
| josh_ohara | 6:5bea67cc96f9 | 19 | SpaceInvaderEngine(); |
| josh_ohara | 8:86cb9a9f8a73 | 20 | ~SpaceInvaderEngine(); |
| josh_ohara | 15:dde4ce4bf7fe | 21 | 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 | 22 | void read_input(Gamepad &pad); |
| josh_ohara | 10:9189419fda68 | 23 | void update(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 8:86cb9a9f8a73 | 24 | void render(N5110 &lcd); |
| josh_ohara | 11:c174d84e4866 | 25 | void shoot_bullet(); |
| josh_ohara | 14:e88bcf5c0887 | 26 | void get_ship_pos(); |
| josh_ohara | 14:e88bcf5c0887 | 27 | void ship_bullet_alien_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 15:dde4ce4bf7fe | 28 | void ship_bullet_cover1_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 15:dde4ce4bf7fe | 29 | void ship_bullet_cover2_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 15:dde4ce4bf7fe | 30 | void ship_bullet_cover3_collision(Gamepad &pad, N5110 &lcd); |
| josh_ohara | 14:e88bcf5c0887 | 31 | |
| josh_ohara | 6:5bea67cc96f9 | 32 | private: |
| josh_ohara | 6:5bea67cc96f9 | 33 | |
| josh_ohara | 12:be491ab6e742 | 34 | Armada A1; |
| josh_ohara | 6:5bea67cc96f9 | 35 | Ship S1; |
| josh_ohara | 11:c174d84e4866 | 36 | BulletS BS1; |
| josh_ohara | 15:dde4ce4bf7fe | 37 | Cover C1; |
| josh_ohara | 15:dde4ce4bf7fe | 38 | Cover C2; |
| josh_ohara | 15:dde4ce4bf7fe | 39 | Cover C3; |
| josh_ohara | 6:5bea67cc96f9 | 40 | |
| josh_ohara | 6:5bea67cc96f9 | 41 | int S1_height; |
| josh_ohara | 6:5bea67cc96f9 | 42 | int S1_width; |
| josh_ohara | 9:8e695df3cc36 | 43 | int A1_size; |
| josh_ohara | 12:be491ab6e742 | 44 | int N; |
| josh_ohara | 12:be491ab6e742 | 45 | int CS; |
| josh_ohara | 12:be491ab6e742 | 46 | int RS; |
| josh_ohara | 6:5bea67cc96f9 | 47 | |
| josh_ohara | 9:8e695df3cc36 | 48 | int A1y; |
| josh_ohara | 14:e88bcf5c0887 | 49 | int S1x; |
| josh_ohara | 14:e88bcf5c0887 | 50 | int S1y; |
| josh_ohara | 15:dde4ce4bf7fe | 51 | int Cy; |
| josh_ohara | 15:dde4ce4bf7fe | 52 | int C1x; |
| josh_ohara | 15:dde4ce4bf7fe | 53 | int C2x; |
| josh_ohara | 15:dde4ce4bf7fe | 54 | int C3x; |
| josh_ohara | 15:dde4ce4bf7fe | 55 | int NR; |
| josh_ohara | 6:5bea67cc96f9 | 56 | |
| josh_ohara | 12:be491ab6e742 | 57 | |
| josh_ohara | 6:5bea67cc96f9 | 58 | Direction D; |
| josh_ohara | 6:5bea67cc96f9 | 59 | float Mag; |
| josh_ohara | 6:5bea67cc96f9 | 60 | |
| josh_ohara | 6:5bea67cc96f9 | 61 | }; |
| josh_ohara | 6:5bea67cc96f9 | 62 | |
| josh_ohara | 6:5bea67cc96f9 | 63 | #endif |