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.

https://os.mbed.com/media/uploads/helioslyons/screenshot_2020-05-27_at_06.12.00.png

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)

https://os.mbed.com/media/uploads/helioslyons/screenshot_2020-05-27_at_06.20.18.png

Committer:
helioslyons
Date:
Wed May 27 15:40:47 2020 +0000
Revision:
13:1472c1637bfc
Parent:
11:1fd8fca23375
Final Submission. I have read and agreed with Statement of Academic Integrity.

Who changed what in which revision?

UserRevisionLine numberNew 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 11:1fd8fca23375 17 /** Constructor */
helioslyons 2:ef7f9892ba4f 18 Canon();
helioslyons 11:1fd8fca23375 19 /** Destructor */
helioslyons 11:1fd8fca23375 20 ~Canon();
helioslyons 11:1fd8fca23375 21
helioslyons 11:1fd8fca23375 22 /** Initialises variables
helioslyons 11:1fd8fca23375 23 * @param boolean for ownership, position (XY - int), and speed (int)
helioslyons 11:1fd8fca23375 24 */
helioslyons 11:1fd8fca23375 25 void init(int y);
helioslyons 2:ef7f9892ba4f 26
helioslyons 11:1fd8fca23375 27 /** Draws contents to LCD
helioslyons 11:1fd8fca23375 28 * @param bitmap and position values (bit, int)
helioslyons 11:1fd8fca23375 29 */
helioslyons 2:ef7f9892ba4f 30 void draw(N5110 &lcd);
helioslyons 11:1fd8fca23375 31
helioslyons 11:1fd8fca23375 32 /** Updates position
helioslyons 11:1fd8fca23375 33 * @param vector, position values (Vector2D, int), direction (char) and magnitude (float)
helioslyons 11:1fd8fca23375 34 */
helioslyons 2:ef7f9892ba4f 35 void update(Direction d,float mag);
helioslyons 10:19b250c7de5e 36
helioslyons 11:1fd8fca23375 37 /** Gets current position
helioslyons 11:1fd8fca23375 38 * @return current position (Vector2D)
helioslyons 11:1fd8fca23375 39 */
helioslyons 2:ef7f9892ba4f 40 Vector2D get_pos();
helioslyons 11:1fd8fca23375 41
helioslyons 11:1fd8fca23375 42 /** Gets current lives
helioslyons 11:1fd8fca23375 43 * @return value for life (int)
helioslyons 11:1fd8fca23375 44 */
helioslyons 11:1fd8fca23375 45 int get_life();
helioslyons 11:1fd8fca23375 46
helioslyons 11:1fd8fca23375 47 /** Decrements current lives
helioslyons 11:1fd8fca23375 48 * @return decremented value of lives (int)
helioslyons 11:1fd8fca23375 49 */
helioslyons 11:1fd8fca23375 50 int remove_life();
helioslyons 2:ef7f9892ba4f 51
helioslyons 11:1fd8fca23375 52 /** Resets current lives
helioslyons 11:1fd8fca23375 53 * @return reset value of lives (int = 3)
helioslyons 11:1fd8fca23375 54 */
helioslyons 2:ef7f9892ba4f 55 int reset_life();
helioslyons 11:1fd8fca23375 56
helioslyons 11:1fd8fca23375 57 /** Returns canon width
helioslyons 11:1fd8fca23375 58 * @return width (int)
helioslyons 11:1fd8fca23375 59 */
helioslyons 11:1fd8fca23375 60 int get_width();
helioslyons 11:1fd8fca23375 61
helioslyons 11:1fd8fca23375 62 /** Returns canon height
helioslyons 11:1fd8fca23375 63 * @return height (int)
helioslyons 11:1fd8fca23375 64 */
helioslyons 11:1fd8fca23375 65 int get_height();
helioslyons 2:ef7f9892ba4f 66
helioslyons 2:ef7f9892ba4f 67 private:
helioslyons 2:ef7f9892ba4f 68
helioslyons 2:ef7f9892ba4f 69 int _height;
helioslyons 2:ef7f9892ba4f 70 int _width;
helioslyons 2:ef7f9892ba4f 71 int _x;
helioslyons 2:ef7f9892ba4f 72 int _y;
helioslyons 2:ef7f9892ba4f 73 int _speed;
helioslyons 2:ef7f9892ba4f 74 int _life;
helioslyons 2:ef7f9892ba4f 75
helioslyons 2:ef7f9892ba4f 76 };
helioslyons 2:ef7f9892ba4f 77 #endif