Helios Lyons 201239214
Dependencies: mbed
Brief
My aim for this project was to create a FRDM K64F adapted version of the classic Space Invaders by Tomohiro Nishikado. The game itself has a number of clear features to implement;
- Left to right movement for the player 'canon'
- A fixed amount of player lives
- Firing mechanics for both canon and invaders (hence collision systems)
- Random firing from remaining invaders
- Wave based combat
My own addition to these established ideas was Boss waves, featuring a single, larger sprite which fires at a faster interval than previous waves. The addition of a movement system using a basic for loop, as opposed to a velocity based system, will enhance the nostalgic feel of the game.
Gameplay
Movement is controlled with the joystick, moving the canon left or right. Fire by pressing A. Invaders spawn at set positions, but randomly fire at a set interval, which is higher for boss waves. Time is taken during each wave, and displayed at wave intervals, and if the play wins.
Controls are shown on the Gamepad below: (attribution: Craig A. Evans, ELEC2645 University of Leeds)
Canon/Canon.h@10:19b250c7de5e, 2020-05-18 (annotated)
- Committer:
- helioslyons
- Date:
- Mon May 18 18:14:35 2020 +0000
- Revision:
- 10:19b250c7de5e
- Parent:
- 4:c644522ff9d9
- Child:
- 11:1fd8fca23375
Helios Lyons 201239214
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
helioslyons | 2:ef7f9892ba4f | 1 | #ifndef CANON_H |
helioslyons | 2:ef7f9892ba4f | 2 | #define CANON_H |
helioslyons | 2:ef7f9892ba4f | 3 | |
helioslyons | 2:ef7f9892ba4f | 4 | #include "mbed.h" |
helioslyons | 2:ef7f9892ba4f | 5 | #include "N5110.h" |
helioslyons | 2:ef7f9892ba4f | 6 | #include "Gamepad.h" |
helioslyons | 2:ef7f9892ba4f | 7 | |
helioslyons | 2:ef7f9892ba4f | 8 | /** Canon.h |
helioslyons | 2:ef7f9892ba4f | 9 | * @brief Defines variables and methods for the Canon. |
helioslyons | 2:ef7f9892ba4f | 10 | * @author Helios A. Lyons |
helioslyons | 2:ef7f9892ba4f | 11 | * @date April, 2020 |
helioslyons | 2:ef7f9892ba4f | 12 | */ |
helioslyons | 2:ef7f9892ba4f | 13 | |
helioslyons | 2:ef7f9892ba4f | 14 | class Canon |
helioslyons | 2:ef7f9892ba4f | 15 | { |
helioslyons | 2:ef7f9892ba4f | 16 | public: |
helioslyons | 2:ef7f9892ba4f | 17 | |
helioslyons | 2:ef7f9892ba4f | 18 | Canon(); |
helioslyons | 4:c644522ff9d9 | 19 | ~Canon(); // destructor |
helioslyons | 2:ef7f9892ba4f | 20 | |
helioslyons | 10:19b250c7de5e | 21 | void init(int y); |
helioslyons | 2:ef7f9892ba4f | 22 | void draw(N5110 &lcd); |
helioslyons | 2:ef7f9892ba4f | 23 | void update(Direction d,float mag); |
helioslyons | 2:ef7f9892ba4f | 24 | // int add_total_kills(); –– replaced by adding individual type kills |
helioslyons | 10:19b250c7de5e | 25 | |
helioslyons | 10:19b250c7de5e | 26 | int kill(int sprite); |
helioslyons | 10:19b250c7de5e | 27 | |
helioslyons | 2:ef7f9892ba4f | 28 | int get_score(); |
helioslyons | 2:ef7f9892ba4f | 29 | |
helioslyons | 2:ef7f9892ba4f | 30 | Vector2D get_pos(); |
helioslyons | 10:19b250c7de5e | 31 | int get_x_pos(); // pls delete dumbass |
helioslyons | 10:19b250c7de5e | 32 | int get_y_pos(); |
helioslyons | 2:ef7f9892ba4f | 33 | |
helioslyons | 2:ef7f9892ba4f | 34 | int get_life(); |
helioslyons | 2:ef7f9892ba4f | 35 | int remove_life(); |
helioslyons | 2:ef7f9892ba4f | 36 | int reset_life(); |
helioslyons | 2:ef7f9892ba4f | 37 | |
helioslyons | 2:ef7f9892ba4f | 38 | private: |
helioslyons | 2:ef7f9892ba4f | 39 | |
helioslyons | 2:ef7f9892ba4f | 40 | int _height; |
helioslyons | 2:ef7f9892ba4f | 41 | int _width; |
helioslyons | 2:ef7f9892ba4f | 42 | int _x; |
helioslyons | 2:ef7f9892ba4f | 43 | int _y; |
helioslyons | 2:ef7f9892ba4f | 44 | int _speed; |
helioslyons | 2:ef7f9892ba4f | 45 | int _score; |
helioslyons | 2:ef7f9892ba4f | 46 | int _inv1_kill; |
helioslyons | 2:ef7f9892ba4f | 47 | int _inv2_kill; |
helioslyons | 2:ef7f9892ba4f | 48 | int _inv3_kill; |
helioslyons | 2:ef7f9892ba4f | 49 | int _boss_kill; |
helioslyons | 2:ef7f9892ba4f | 50 | int _total_kill; |
helioslyons | 2:ef7f9892ba4f | 51 | int _life; |
helioslyons | 2:ef7f9892ba4f | 52 | |
helioslyons | 2:ef7f9892ba4f | 53 | }; |
helioslyons | 2:ef7f9892ba4f | 54 | #endif |