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:
Mon May 18 18:14:35 2020 +0000
Revision:
10:19b250c7de5e
Parent:
9:6a245c8ce08e
Child:
11:1fd8fca23375
Helios Lyons 201239214

Who changed what in which revision?

UserRevisionLine numberNew 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 10:19b250c7de5e 10 #include "Bullet.h"
helioslyons 10:19b250c7de5e 11
helioslyons 10:19b250c7de5e 12 #include <vector>
helioslyons 10:19b250c7de5e 13
helioslyons 10:19b250c7de5e 14 #define SPACE 2
helioslyons 8:ec4199484adf 15
helioslyons 8:ec4199484adf 16 class Battle
helioslyons 8:ec4199484adf 17 {
helioslyons 8:ec4199484adf 18
helioslyons 8:ec4199484adf 19 public:
helioslyons 8:ec4199484adf 20 Battle();
helioslyons 8:ec4199484adf 21 ~Battle();
helioslyons 8:ec4199484adf 22
helioslyons 10:19b250c7de5e 23 void init(int invaders, int speed, int interval);
helioslyons 9:6a245c8ce08e 24 void invader_fire();
helioslyons 10:19b250c7de5e 25 void canon_fire(Gamepad &pad);
helioslyons 8:ec4199484adf 26 void read_input(Gamepad &pad);
helioslyons 8:ec4199484adf 27 void update(Gamepad &pad);
helioslyons 8:ec4199484adf 28 void draw(N5110 &lcd);
helioslyons 10:19b250c7de5e 29 void bullet_collisions();
helioslyons 10:19b250c7de5e 30
helioslyons 10:19b250c7de5e 31 vector<Bullet> invBomb;
helioslyons 10:19b250c7de5e 32 vector<Bullet> playBul;
helioslyons 8:ec4199484adf 33
helioslyons 8:ec4199484adf 34 private:
helioslyons 8:ec4199484adf 35
helioslyons 10:19b250c7de5e 36 void check_invader_hit(Gamepad &pad);
helioslyons 10:19b250c7de5e 37 void check_canon_hit(Gamepad &pad);
helioslyons 10:19b250c7de5e 38 void print_score(N5110 &lcd);
helioslyons 8:ec4199484adf 39
helioslyons 8:ec4199484adf 40 int _speed;
helioslyons 8:ec4199484adf 41 int _x;
helioslyons 9:6a245c8ce08e 42 int _interval;
helioslyons 10:19b250c7de5e 43 int _invaders;
helioslyons 8:ec4199484adf 44
helioslyons 8:ec4199484adf 45 Canon _canon;
helioslyons 10:19b250c7de5e 46 Army _army;
helioslyons 10:19b250c7de5e 47 Bullet _bullet;
helioslyons 8:ec4199484adf 48
helioslyons 8:ec4199484adf 49 Direction _d;
helioslyons 8:ec4199484adf 50 float _mag;
helioslyons 8:ec4199484adf 51
helioslyons 8:ec4199484adf 52 };
helioslyons 8:ec4199484adf 53
helioslyons 8:ec4199484adf 54 #endif