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.

Files at this revision

API Documentation at this revision

Comitter:
el18jgb
Date:
Sun May 24 11:24:57 2020 +0000
Parent:
22:7406068f6c59
Commit message:
Final Submission. I have read and agreed with Statement of Academic Integrity.

Changed in this revision

Aim/Aim.cpp Show annotated file Show diff for this revision Revisions of this file
Heston/Heston.cpp Show annotated file Show diff for this revision Revisions of this file
main.cpp Show annotated file Show diff for this revision Revisions of this file
menu/Menu.cpp Show annotated file Show diff for this revision Revisions of this file
--- a/Aim/Aim.cpp	Sun May 24 10:28:20 2020 +0000
+++ b/Aim/Aim.cpp	Sun May 24 11:24:57 2020 +0000
@@ -106,10 +106,10 @@
 void Aim::acc_control(FXOS8700CQ &acc)
 {
     float roll = acc.get_roll_angle();
-    _x = _x + roll;
+    _x = _x + (roll/2);
     //printf("roll =  %f\n", roll);
     float pitch = acc.get_pitch_angle();
-    _y = _y - pitch;
+    _y = _y - (pitch/2);
     //printf("pitch =  %f\n", pitch);
     
     // check the x origin to ensure that the paddle doesn't go off screen
--- a/Heston/Heston.cpp	Sun May 24 10:28:20 2020 +0000
+++ b/Heston/Heston.cpp	Sun May 24 11:24:57 2020 +0000
@@ -7,9 +7,9 @@
     {0,0,1,1,1,1,1,1,1,0,0},//any resemblance to the celebrity chef is purely coincidental...honestly
     {0,1,0,0,0,0,0,0,0,1,0},//other celebrity chefs are available
     {1,1,1,1,1,1,1,1,1,1,1},
-    {1,0,1,0,1,0,1,0,1,0,1},
-    {1,0,1,1,1,0,1,1,1,0,1},
-    {0,1,0,0,0,1,0,0,0,1,0},
+    {1,0,1,0,1,0,1,0,1,0,1},//unfortunetly i got the lockdown shaved head
+    {1,0,1,1,1,0,1,1,1,0,1},//this is a referance to a mate saying i look like
+    {0,1,0,0,0,1,0,0,0,1,0},//heston with my specs on
     {0,1,0,0,0,0,0,0,0,1,0},
     {0,1,0,1,1,1,1,1,0,1,0},
     {0,1,0,0,1,1,1,0,0,1,0},
--- a/main.cpp	Sun May 24 10:28:20 2020 +0000
+++ b/main.cpp	Sun May 24 11:24:57 2020 +0000
@@ -39,18 +39,11 @@
 Highscore hs;
 SDFileSystem sd(PTE3, PTE1, PTE2, PTE4, "sd");
 
-// flag - must be volatile as changes within ISR
-// g_ prefix makes it easier to distinguish it as global
-volatile int g_timer_flag = 0;
-
-// function prototypes
-void timer_isr();
-
 
 void init();
 void render();
 void play(Gamepad &pad, N5110 &lcd, FXOS8700CQ &acc);
-//void read_input(Gamepad &pad);
+
 
 int main()
 {
@@ -117,9 +110,9 @@
     while (1) {
         //read_input(pad);
         int fire = 0;
-        if (A_timer <= 0){
+        if (A_timer <= 0){//shot timer to prevent spam
             fire = 0;
-            if (pad.A_held()){
+            if (pad.A_held()){//a held worked better than pressed
                 fire = 1;
                 A_timer = 6;
                 
--- a/menu/Menu.cpp	Sun May 24 10:28:20 2020 +0000
+++ b/menu/Menu.cpp	Sun May 24 11:24:57 2020 +0000
@@ -77,7 +77,7 @@
         option = 3;
     }
     
-    if (option == 0){
+    if (option == 0){//despite being a 'mode' this means an option is always chosen
         option = 1;
     }
     
@@ -99,7 +99,7 @@
 
 void Menu::instructions(N5110 &lcd, Gamepad &pad)
 {
-    while ( pad.B_held() == false) {
+    while ( pad.B_held() == false) {//b held works better than pressed
         lcd.clear();
             
         lcd.printString(" Instructions ",0,0);  
@@ -121,7 +121,7 @@
 void Menu::highs_screen(N5110 &lcd, Gamepad &pad, Highscore &hs, SDFileSystem &sd)
 {
 
-    while ( pad.B_held() == false) {
+    while ( pad.B_held() == false) {//b held works better than pressed
         lcd.clear();
         
         int value = hs.geths(sd);
@@ -129,8 +129,8 @@
         lcd.printString("   Highscore  ",0,0);
         
         char buffer1[14];
-        sprintf(buffer1,"%2d",value);
-        lcd.printString(buffer1,34,3);  // font is 8 wide, so leave 4 pixel gape from middle assuming two digits
+        sprintf(buffer1,"%2d",value);//prints the stored score
+        lcd.printString(buffer1,34,3);  
 
         lcd.printString("return press B",0,5);