Joe Body 201215898

Dependencies:   mbed

Navigation

  • From the Main Menu the A button will take you into one of the play, highscore or instructions options.
  • The B button will return you to the Main Menu from either the highscore or instruction screens, though this is prompted on screen.
  • When in the Main Menu Pot1 can be used to adjust the contrast and the volume control by the speaker is active.
  • When the game is over the B button can be used to return to the Main Menu, again this is prompted.
  • To return to the Main Menu while the game is being played the reset button must be pressed, this will not save your score or anything about the game.

In Game

  • While in the game the A button is used to shoot while you aim with the Joystick.
  • You have control over the cross while the objective of the game is to rack up as many points shooting the moving head.
  • There is a slight reload time on each shot so you are unable to spam A if you miss.
  • Once you miss 6 times the game will end and your score will be saved.
  • When hit by a falling spike the game will transition and the head will vanish.
  • 4 new spikes will spawn which you need to avoid, being hit by 1 of these will decrease your remaining miss chances by 5.
  • When the game is in this state you must avoid these spikes by tilting the device, the Joystick will have no effect.
  • The head will move progressively faster as the game goes on, make use of the clock power up by shooting it when it appears, this will slow the head down to a more manageable level hopefully helping you to reach a higher score.

Highscore

  • If you have a SD card inserted into the device the game can save your highest score.
  • A decent score is somewhere around 25.

main.cpp

Committer:
el18jgb
Date:
2020-04-30
Revision:
2:56b31902c800
Parent:
1:1144f48b5965
Child:
3:5d28062d0a2d

File content as of revision 2:56b31902c800:

/* 
ELEC2645 Embedded Systems Project
School of Electronic & Electrical Engineering
University of Leeds
2019/20

Name:Joe Body
Username:el18jgb
Student ID Number:201215898
Date:11/03/2020
*/

// includes
#include "mbed.h"
#include "Gamepad.h"
#include "N5110.h"
#include "Basket.h"
#include "Heston.h"



// objects
Gamepad pad;
N5110 lcd;
Basket basket;
Heston heston;



void init();
void render();
//void draw(N5110 &lcd);
//void read_input(Gamepad &pad);

int main()
{
    int fps = 6;  // frames per second
    

    init();     // initialise and then display welcome screen...
    
    render();  // first draw the initial frame 
    wait(1.0f/fps);  // and wait for one frame period
    while (1) {
        //read_input(pad);
        heston.update(pad);
        basket.update(pad);
        render();
        wait(1.0f/fps);
    }
    
}

// initialies all classes and libraries
void init()
{
    // need to initialise LCD and Gamepad 
    lcd.init();
    pad.init();
    basket.init();
    heston.init();

}

// this function draws each frame on the LCD
void render()
{
    // clear screen, re-draw and refresh
    lcd.clear(); 
    basket.draw(lcd); 
    heston.draw(lcd);
    lcd.refresh();
}

//void read_input(Gamepad &pad)
//{
    //int _d = pad.get_direction();
    //float _mag = pad.get_mag();
//}