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.
Committer:
el18jgb
Date:
Thu Apr 30 15:40:22 2020 +0000
Revision:
3:5d28062d0a2d
Parent:
2:56b31902c800
Child:
4:6f898b000797
heston is moving randombly,; can now move basket in all directions

Who changed what in which revision?

UserRevisionLine numberNew contents of line
eencae 0:b7f1f47bb26a 1 /*
eencae 0:b7f1f47bb26a 2 ELEC2645 Embedded Systems Project
eencae 0:b7f1f47bb26a 3 School of Electronic & Electrical Engineering
eencae 0:b7f1f47bb26a 4 University of Leeds
eencae 0:b7f1f47bb26a 5 2019/20
eencae 0:b7f1f47bb26a 6
el18jgb 1:1144f48b5965 7 Name:Joe Body
el18jgb 1:1144f48b5965 8 Username:el18jgb
el18jgb 1:1144f48b5965 9 Student ID Number:201215898
el18jgb 1:1144f48b5965 10 Date:11/03/2020
eencae 0:b7f1f47bb26a 11 */
eencae 0:b7f1f47bb26a 12
eencae 0:b7f1f47bb26a 13 // includes
eencae 0:b7f1f47bb26a 14 #include "mbed.h"
eencae 0:b7f1f47bb26a 15 #include "Gamepad.h"
eencae 0:b7f1f47bb26a 16 #include "N5110.h"
el18jgb 1:1144f48b5965 17 #include "Basket.h"
el18jgb 2:56b31902c800 18 #include "Heston.h"
el18jgb 2:56b31902c800 19
eencae 0:b7f1f47bb26a 20
eencae 0:b7f1f47bb26a 21
eencae 0:b7f1f47bb26a 22 // objects
eencae 0:b7f1f47bb26a 23 Gamepad pad;
eencae 0:b7f1f47bb26a 24 N5110 lcd;
el18jgb 1:1144f48b5965 25 Basket basket;
el18jgb 2:56b31902c800 26 Heston heston;
el18jgb 1:1144f48b5965 27
el18jgb 1:1144f48b5965 28
el18jgb 1:1144f48b5965 29
el18jgb 1:1144f48b5965 30 void init();
el18jgb 1:1144f48b5965 31 void render();
el18jgb 1:1144f48b5965 32 //void draw(N5110 &lcd);
el18jgb 1:1144f48b5965 33 //void read_input(Gamepad &pad);
eencae 0:b7f1f47bb26a 34
eencae 0:b7f1f47bb26a 35 int main()
eencae 0:b7f1f47bb26a 36 {
el18jgb 1:1144f48b5965 37 int fps = 6; // frames per second
el18jgb 1:1144f48b5965 38
el18jgb 3:5d28062d0a2d 39 srand (pad.read_pot1()*30000);
el18jgb 1:1144f48b5965 40
el18jgb 1:1144f48b5965 41 init(); // initialise and then display welcome screen...
el18jgb 1:1144f48b5965 42
el18jgb 1:1144f48b5965 43 render(); // first draw the initial frame
el18jgb 1:1144f48b5965 44 wait(1.0f/fps); // and wait for one frame period
el18jgb 1:1144f48b5965 45 while (1) {
el18jgb 1:1144f48b5965 46 //read_input(pad);
el18jgb 2:56b31902c800 47 heston.update(pad);
el18jgb 1:1144f48b5965 48 basket.update(pad);
el18jgb 1:1144f48b5965 49 render();
el18jgb 1:1144f48b5965 50 wait(1.0f/fps);
el18jgb 1:1144f48b5965 51 }
eencae 0:b7f1f47bb26a 52
eencae 0:b7f1f47bb26a 53 }
eencae 0:b7f1f47bb26a 54
el18jgb 1:1144f48b5965 55 // initialies all classes and libraries
el18jgb 1:1144f48b5965 56 void init()
el18jgb 1:1144f48b5965 57 {
el18jgb 1:1144f48b5965 58 // need to initialise LCD and Gamepad
el18jgb 1:1144f48b5965 59 lcd.init();
el18jgb 1:1144f48b5965 60 pad.init();
el18jgb 1:1144f48b5965 61 basket.init();
el18jgb 2:56b31902c800 62 heston.init();
el18jgb 1:1144f48b5965 63
el18jgb 1:1144f48b5965 64 }
el18jgb 1:1144f48b5965 65
el18jgb 1:1144f48b5965 66 // this function draws each frame on the LCD
el18jgb 1:1144f48b5965 67 void render()
el18jgb 1:1144f48b5965 68 {
el18jgb 1:1144f48b5965 69 // clear screen, re-draw and refresh
el18jgb 1:1144f48b5965 70 lcd.clear();
el18jgb 1:1144f48b5965 71 basket.draw(lcd);
el18jgb 2:56b31902c800 72 heston.draw(lcd);
el18jgb 1:1144f48b5965 73 lcd.refresh();
el18jgb 1:1144f48b5965 74 }
el18jgb 1:1144f48b5965 75
el18jgb 1:1144f48b5965 76 //void read_input(Gamepad &pad)
el18jgb 1:1144f48b5965 77 //{
el18jgb 1:1144f48b5965 78 //int _d = pad.get_direction();
el18jgb 1:1144f48b5965 79 //float _mag = pad.get_mag();
el18jgb 1:1144f48b5965 80 //}
el18jgb 1:1144f48b5965 81