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 05:07:34 2020 +0000
Revision:
11:1fd8fca23375
Parent:
10:19b250c7de5e
Helios A. Lyons 201239214;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
helioslyons 4:c644522ff9d9 1 #ifndef INVADER_H
helioslyons 4:c644522ff9d9 2 #define INVADER_H
helioslyons 4:c644522ff9d9 3
helioslyons 4:c644522ff9d9 4 #include "mbed.h"
helioslyons 4:c644522ff9d9 5 #include "N5110.h"
helioslyons 4:c644522ff9d9 6 #include "Gamepad.h"
helioslyons 4:c644522ff9d9 7
helioslyons 4:c644522ff9d9 8 /** Invader.h
helioslyons 11:1fd8fca23375 9 * @brief Defines variables and methods for the Invader object
helioslyons 4:c644522ff9d9 10 * @author Helios A. Lyons
helioslyons 4:c644522ff9d9 11 * @date April, 2020
helioslyons 4:c644522ff9d9 12 */
helioslyons 4:c644522ff9d9 13
helioslyons 4:c644522ff9d9 14 class Invader
helioslyons 4:c644522ff9d9 15 {
helioslyons 4:c644522ff9d9 16 public:
helioslyons 11:1fd8fca23375 17 /** Constructor */
helioslyons 4:c644522ff9d9 18 Invader();
helioslyons 11:1fd8fca23375 19 /** Destructor */
helioslyons 4:c644522ff9d9 20 ~Invader();
helioslyons 4:c644522ff9d9 21
helioslyons 11:1fd8fca23375 22 /** Initialises variables
helioslyons 11:1fd8fca23375 23 * @param value for sprite, hitpoints and boss (int)
helioslyons 11:1fd8fca23375 24 */
helioslyons 11:1fd8fca23375 25 void init(int sprite, int hitpoints, int boss);
helioslyons 11:1fd8fca23375 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 4:c644522ff9d9 30 void draw(N5110 &lcd);
helioslyons 11:1fd8fca23375 31
helioslyons 11:1fd8fca23375 32 /** Gets sprite value
helioslyons 11:1fd8fca23375 33 * @return sprite value (int)
helioslyons 11:1fd8fca23375 34 */
helioslyons 10:19b250c7de5e 35 int get_sprite();
helioslyons 4:c644522ff9d9 36
helioslyons 11:1fd8fca23375 37 /** Decrement hitpoints
helioslyons 11:1fd8fca23375 38 * @return a decremented value for hitpoints
helioslyons 11:1fd8fca23375 39 */
helioslyons 4:c644522ff9d9 40 int hit();
helioslyons 11:1fd8fca23375 41
helioslyons 11:1fd8fca23375 42 /** Returns death
helioslyons 11:1fd8fca23375 43 * @return boolean for death state
helioslyons 11:1fd8fca23375 44 */
helioslyons 4:c644522ff9d9 45 bool get_death();
helioslyons 4:c644522ff9d9 46
helioslyons 11:1fd8fca23375 47 /** Gets position
helioslyons 11:1fd8fca23375 48 * @return current position (Vector2D)
helioslyons 11:1fd8fca23375 49 */
helioslyons 4:c644522ff9d9 50 Vector2D get_pos();
helioslyons 7:5fe9ac6522c5 51
helioslyons 11:1fd8fca23375 52 /** Gets width
helioslyons 11:1fd8fca23375 53 * @return width of sprite (int)
helioslyons 11:1fd8fca23375 54 */
helioslyons 11:1fd8fca23375 55 int get_width();
helioslyons 7:5fe9ac6522c5 56
helioslyons 11:1fd8fca23375 57 /** Gets height
helioslyons 11:1fd8fca23375 58 * @return height of sprite (int)
helioslyons 11:1fd8fca23375 59 */
helioslyons 11:1fd8fca23375 60 int get_height();
helioslyons 11:1fd8fca23375 61
helioslyons 11:1fd8fca23375 62 /** Sets position
helioslyons 11:1fd8fca23375 63 * @param sets position based on x and y inputs (int)
helioslyons 11:1fd8fca23375 64 */
helioslyons 6:e3a1bfbb1627 65 void set_pos(int x, int y);
helioslyons 7:5fe9ac6522c5 66
helioslyons 11:1fd8fca23375 67 int _speed;
helioslyons 4:c644522ff9d9 68
helioslyons 4:c644522ff9d9 69 private:
helioslyons 4:c644522ff9d9 70
helioslyons 4:c644522ff9d9 71 int _height;
helioslyons 4:c644522ff9d9 72 int _width;
helioslyons 4:c644522ff9d9 73 int _x;
helioslyons 4:c644522ff9d9 74 int _y;
helioslyons 4:c644522ff9d9 75 int _hitpoints;
helioslyons 4:c644522ff9d9 76 bool _death;
helioslyons 4:c644522ff9d9 77 int _sprite;
helioslyons 11:1fd8fca23375 78
helioslyons 11:1fd8fca23375 79 Vector2D _velocity;
helioslyons 11:1fd8fca23375 80
helioslyons 4:c644522ff9d9 81
helioslyons 4:c644522ff9d9 82 };
helioslyons 4:c644522ff9d9 83 #endif