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:
Sun May 17 14:01:17 2020 +0000
Revision:
9:6a245c8ce08e
Child:
10:19b250c7de5e
Helios Lyons 201239214

Who changed what in which revision?

UserRevisionLine numberNew contents of line
helioslyons 9:6a245c8ce08e 1 #include "Battle.h"
helioslyons 9:6a245c8ce08e 2
helioslyons 9:6a245c8ce08e 3 Battle::Battle()
helioslyons 9:6a245c8ce08e 4 {
helioslyons 9:6a245c8ce08e 5
helioslyons 9:6a245c8ce08e 6 }
helioslyons 9:6a245c8ce08e 7
helioslyons 9:6a245c8ce08e 8 Battle::~Battle()
helioslyons 9:6a245c8ce08e 9 {
helioslyons 9:6a245c8ce08e 10
helioslyons 9:6a245c8ce08e 11 }
helioslyons 9:6a245c8ce08e 12
helioslyons 9:6a245c8ce08e 13 void Battle::init(int speed)
helioslyons 9:6a245c8ce08e 14 {
helioslyons 9:6a245c8ce08e 15
helioslyons 9:6a245c8ce08e 16 }
helioslyons 9:6a245c8ce08e 17
helioslyons 9:6a245c8ce08e 18 void Battle::fire()
helioslyons 9:6a245c8ce08e 19 {
helioslyons 9:6a245c8ce08e 20 Army.rand_invader();
helioslyons 9:6a245c8ce08e 21
helioslyons 9:6a245c8ce08e 22 }
helioslyons 9:6a245c8ce08e 23
helioslyons 9:6a245c8ce08e 24 void Battle::read_input(Gamepad &pad)
helioslyons 9:6a245c8ce08e 25 {
helioslyons 9:6a245c8ce08e 26
helioslyons 9:6a245c8ce08e 27 }
helioslyons 9:6a245c8ce08e 28
helioslyons 9:6a245c8ce08e 29 void Battle::invader_fire()
helioslyons 9:6a245c8ce08e 30 {
helioslyons 9:6a245c8ce08e 31 // use _interval to determine wait time
helioslyons 9:6a245c8ce08e 32 }
helioslyons 9:6a245c8ce08e 33
helioslyons 9:6a245c8ce08e 34 void Battle::fire()
helioslyons 9:6a245c8ce08e 35 {
helioslyons 9:6a245c8ce08e 36 // when a (x) is pressed, add bullet to player vector, set velocity
helioslyons 9:6a245c8ce08e 37 }
helioslyons 9:6a245c8ce08e 38
helioslyons 9:6a245c8ce08e 39 void Battle::check_invader_hit(Gamepad &pad)
helioslyons 9:6a245c8ce08e 40 {
helioslyons 9:6a245c8ce08e 41 // reference a vector of player bullet objects, and check if coordinates match that of invaders (+- width)
helioslyons 9:6a245c8ce08e 42 // save invader index in temp to get the sprite if they do – add scores
helioslyons 9:6a245c8ce08e 43 }
helioslyons 9:6a245c8ce08e 44
helioslyons 9:6a245c8ce08e 45 void Battle::check_canon_hit(Gamepad &pad)
helioslyons 9:6a245c8ce08e 46 {
helioslyons 9:6a245c8ce08e 47 // reference a vector of invader bullet objects, and check if coordinates match that of canon (+- width)
helioslyons 9:6a245c8ce08e 48 // if they do, make the canon flicker with a 0.2ms interval 3 times
helioslyons 9:6a245c8ce08e 49 // if lives = 0 then terminate
helioslyons 9:6a245c8ce08e 50 }
helioslyons 9:6a245c8ce08e 51
helioslyons 9:6a245c8ce08e 52 void Battle::print_scores(N5110 &lcd)
helioslyons 9:6a245c8ce08e 53 {
helioslyons 9:6a245c8ce08e 54 // use get_score method from canon
helioslyons 9:6a245c8ce08e 55 }
helioslyons 9:6a245c8ce08e 56
helioslyons 9:6a245c8ce08e 57 void check_invader_hit(Gamepad &pad); // if invader has been hit – need to call add_invx_kill in the invader collisions
helioslyons 9:6a245c8ce08e 58 void check_canon_hit(Gamepad &pad); // if canon has been hit
helioslyons 9:6a245c8ce08e 59 //void check_kill(Gamepad &pad);
helioslyons 9:6a245c8ce08e 60 void print_scores(N5110 &lcd); // use invader get_score method