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.

test.h

Committer:
el18jgb
Date:
2020-05-24
Revision:
23:0e8155320571
Parent:
22:7406068f6c59

File content as of revision 23:0e8155320571:

#ifndef TESTS_H
#define TESTS_H

#include "Spikes_test.h"
#include "Aim_test.h"
#include "Eng_test.h"
#include "Pup_test.h"
#include "Heston_test.h"
#include "Highscore_test.h"
#include "Menu_test.h"
#include "SDFileSystem.h"

/**
 * @brief Run all the tests for this program
 *
 * @returns The number of tests that failed
 */
 

int run_all_tests(SDFileSystem &sd)
{
    int n_tests_failed = 0; // A log of the number of tests that have failed
    
    // Run the aim initialisation test
    printf("Testing Aim_test_initialise ...\n");
    bool test_passed1 = Aim_test_initial();

    // Print out the result of this test
    if (test_passed1) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run the Heston initialisation test
    printf("Testing Heston_test_initialise ...\n");
    bool test_passed2 = Heston_test_initial();

    // Print out the result of this test
    if (test_passed2) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run the Heston collison test
    printf("Testing collision_heston_test ...\n");
    bool test_passed3 = collision_hest_test();

    // Print out the result of this test
    if (test_passed3) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run the spike collison test
    printf("Testing collision_spike_test ...\n");
    bool test_passed4 = collision_spike_test();

    // Print out the result of this test
    if (test_passed4) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run the power up collison test
    printf("Testing collision_pup_test ...\n");
    bool test_passed5 = collision_pup_test();

    // Print out the result of this test
    if (test_passed5) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    //sd card protection
    int protect = hs.geths(sd);
    
    // Run highscore test
    printf("Testing highscore_test ...\n");
    bool test_passed6 = highscore_test(sd);

    // Print out the result of this test
    if (test_passed6) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    hs.seths(sd, protect);//rewrites highscore that was on card if ran with tests
    
    // Run menu test
    printf("Testing menu_test ...\n");
    bool test_passed7 = menu_test();

    // Print out the result of this test
    if (test_passed7) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run power up positioning test
    printf("Testing pup_test_double ...\n");
    bool test_passed8 = pup_test_double();

    // Print out the result of this test
    if (test_passed8) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run spike updating y test
    printf("Testing spikes update y ...\n");
    bool test_passed9 = spikes_test_updatey();

    // Print out the result of this test
    if (test_passed9) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run spike updating x test
    printf("Testing spikes update x ...\n");
    bool test_passed10 = spikes_test_updatex();

    // Print out the result of this test
    if (test_passed10) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    
    // Run spike updating x negativly test
    printf("Testing spike update negative x...\n");
    bool test_passed11 = spikes_test_updatexn();

    // Print out the result of this test
    if (test_passed11) {
        printf("...Passed!\n");
    }
    else {
        printf("...FAILED!\n");
        ++n_tests_failed; // Increment number of failures
    }
    // Repeat the above for each testing function...
    // ...
    // ...

    // Finish by printing a summary of the tests
    if (n_tests_failed > 0) {
        printf("%d tests FAILED!\n", n_tests_failed);
    }
    else {
        printf("All tests passed!\n");
    }

    return n_tests_failed;
}

#endif