![](/media/cache/group/default_image.jpg.50x50_q85.jpg)
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)
Battle/Battle.h@8:ec4199484adf, 2020-04-22 (annotated)
- Committer:
- helioslyons
- Date:
- Wed Apr 22 14:40:39 2020 +0000
- Revision:
- 8:ec4199484adf
- Child:
- 9:6a245c8ce08e
Implementing bullet firing and storing system. Begun menu design with controller options
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
helioslyons | 8:ec4199484adf | 1 | #ifndef BATTLE_H |
helioslyons | 8:ec4199484adf | 2 | #define BATTLE_H |
helioslyons | 8:ec4199484adf | 3 | |
helioslyons | 8:ec4199484adf | 4 | #include "mbed.h" |
helioslyons | 8:ec4199484adf | 5 | #include "N5110.h" |
helioslyons | 8:ec4199484adf | 6 | #include "Gamepad.h" |
helioslyons | 8:ec4199484adf | 7 | #include "Canon.h" |
helioslyons | 8:ec4199484adf | 8 | #include "Invader.h" |
helioslyons | 8:ec4199484adf | 9 | #include "Army.h" |
helioslyons | 8:ec4199484adf | 10 | |
helioslyons | 8:ec4199484adf | 11 | // #define SCORE_BOARD 4 (top or bottom?) |
helioslyons | 8:ec4199484adf | 12 | |
helioslyons | 8:ec4199484adf | 13 | class Battle |
helioslyons | 8:ec4199484adf | 14 | { |
helioslyons | 8:ec4199484adf | 15 | |
helioslyons | 8:ec4199484adf | 16 | public: |
helioslyons | 8:ec4199484adf | 17 | Battle(); |
helioslyons | 8:ec4199484adf | 18 | ~Battle(); |
helioslyons | 8:ec4199484adf | 19 | |
helioslyons | 8:ec4199484adf | 20 | void init(int speed); |
helioslyons | 8:ec4199484adf | 21 | void read_input(Gamepad &pad); |
helioslyons | 8:ec4199484adf | 22 | void update(Gamepad &pad); |
helioslyons | 8:ec4199484adf | 23 | void draw(N5110 &lcd); |
helioslyons | 8:ec4199484adf | 24 | |
helioslyons | 8:ec4199484adf | 25 | private: |
helioslyons | 8:ec4199484adf | 26 | |
helioslyons | 8:ec4199484adf | 27 | void check_alien_collisions(Gamepad &pad); |
helioslyons | 8:ec4199484adf | 28 | void check_canon_collisions(Gamepad &pad); |
helioslyons | 8:ec4199484adf | 29 | void check_kill(Gamepad &pad); |
helioslyons | 8:ec4199484adf | 30 | void print_scores(N5110 &lcd); // write get.score method |
helioslyons | 8:ec4199484adf | 31 | |
helioslyons | 8:ec4199484adf | 32 | int _speed; |
helioslyons | 8:ec4199484adf | 33 | int _x; |
helioslyons | 8:ec4199484adf | 34 | |
helioslyons | 8:ec4199484adf | 35 | Canon _canon; |
helioslyons | 8:ec4199484adf | 36 | |
helioslyons | 8:ec4199484adf | 37 | Direction _d; |
helioslyons | 8:ec4199484adf | 38 | float _mag; |
helioslyons | 8:ec4199484adf | 39 | |
helioslyons | 8:ec4199484adf | 40 | }; |
helioslyons | 8:ec4199484adf | 41 | |
helioslyons | 8:ec4199484adf | 42 | #endif |