
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@23:0e8155320571, 2020-05-24 (annotated)
- Committer:
- el18jgb
- Date:
- Sun May 24 11:24:57 2020 +0000
- Revision:
- 23:0e8155320571
- Parent:
- 22:7406068f6c59
Final Submission. I have read and agreed with Statement of Academic Integrity.
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
el18jgb | 13:cfdfe60a2327 | 1 | #ifndef TESTS_H |
el18jgb | 13:cfdfe60a2327 | 2 | #define TESTS_H |
el18jgb | 13:cfdfe60a2327 | 3 | |
el18jgb | 13:cfdfe60a2327 | 4 | #include "Spikes_test.h" |
el18jgb | 13:cfdfe60a2327 | 5 | #include "Aim_test.h" |
el18jgb | 13:cfdfe60a2327 | 6 | #include "Eng_test.h" |
el18jgb | 22:7406068f6c59 | 7 | #include "Pup_test.h" |
el18jgb | 13:cfdfe60a2327 | 8 | #include "Heston_test.h" |
el18jgb | 22:7406068f6c59 | 9 | #include "Highscore_test.h" |
el18jgb | 22:7406068f6c59 | 10 | #include "Menu_test.h" |
el18jgb | 22:7406068f6c59 | 11 | #include "SDFileSystem.h" |
el18jgb | 13:cfdfe60a2327 | 12 | |
el18jgb | 13:cfdfe60a2327 | 13 | /** |
el18jgb | 13:cfdfe60a2327 | 14 | * @brief Run all the tests for this program |
el18jgb | 13:cfdfe60a2327 | 15 | * |
el18jgb | 13:cfdfe60a2327 | 16 | * @returns The number of tests that failed |
el18jgb | 13:cfdfe60a2327 | 17 | */ |
el18jgb | 22:7406068f6c59 | 18 | |
el18jgb | 22:7406068f6c59 | 19 | |
el18jgb | 22:7406068f6c59 | 20 | int run_all_tests(SDFileSystem &sd) |
el18jgb | 13:cfdfe60a2327 | 21 | { |
el18jgb | 13:cfdfe60a2327 | 22 | int n_tests_failed = 0; // A log of the number of tests that have failed |
el18jgb | 13:cfdfe60a2327 | 23 | |
el18jgb | 13:cfdfe60a2327 | 24 | // Run the aim initialisation test |
el18jgb | 13:cfdfe60a2327 | 25 | printf("Testing Aim_test_initialise ...\n"); |
el18jgb | 22:7406068f6c59 | 26 | bool test_passed1 = Aim_test_initial(); |
el18jgb | 13:cfdfe60a2327 | 27 | |
el18jgb | 13:cfdfe60a2327 | 28 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 29 | if (test_passed1) { |
el18jgb | 13:cfdfe60a2327 | 30 | printf("...Passed!\n"); |
el18jgb | 13:cfdfe60a2327 | 31 | } |
el18jgb | 13:cfdfe60a2327 | 32 | else { |
el18jgb | 13:cfdfe60a2327 | 33 | printf("...FAILED!\n"); |
el18jgb | 13:cfdfe60a2327 | 34 | ++n_tests_failed; // Increment number of failures |
el18jgb | 13:cfdfe60a2327 | 35 | } |
el18jgb | 13:cfdfe60a2327 | 36 | |
el18jgb | 13:cfdfe60a2327 | 37 | // Run the Heston initialisation test |
el18jgb | 13:cfdfe60a2327 | 38 | printf("Testing Heston_test_initialise ...\n"); |
el18jgb | 22:7406068f6c59 | 39 | bool test_passed2 = Heston_test_initial(); |
el18jgb | 22:7406068f6c59 | 40 | |
el18jgb | 22:7406068f6c59 | 41 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 42 | if (test_passed2) { |
el18jgb | 22:7406068f6c59 | 43 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 44 | } |
el18jgb | 22:7406068f6c59 | 45 | else { |
el18jgb | 22:7406068f6c59 | 46 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 47 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 48 | } |
el18jgb | 22:7406068f6c59 | 49 | |
el18jgb | 22:7406068f6c59 | 50 | // Run the Heston collison test |
el18jgb | 22:7406068f6c59 | 51 | printf("Testing collision_heston_test ...\n"); |
el18jgb | 22:7406068f6c59 | 52 | bool test_passed3 = collision_hest_test(); |
el18jgb | 22:7406068f6c59 | 53 | |
el18jgb | 22:7406068f6c59 | 54 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 55 | if (test_passed3) { |
el18jgb | 22:7406068f6c59 | 56 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 57 | } |
el18jgb | 22:7406068f6c59 | 58 | else { |
el18jgb | 22:7406068f6c59 | 59 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 60 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 61 | } |
el18jgb | 22:7406068f6c59 | 62 | |
el18jgb | 22:7406068f6c59 | 63 | // Run the spike collison test |
el18jgb | 22:7406068f6c59 | 64 | printf("Testing collision_spike_test ...\n"); |
el18jgb | 22:7406068f6c59 | 65 | bool test_passed4 = collision_spike_test(); |
el18jgb | 13:cfdfe60a2327 | 66 | |
el18jgb | 13:cfdfe60a2327 | 67 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 68 | if (test_passed4) { |
el18jgb | 22:7406068f6c59 | 69 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 70 | } |
el18jgb | 22:7406068f6c59 | 71 | else { |
el18jgb | 22:7406068f6c59 | 72 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 73 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 74 | } |
el18jgb | 22:7406068f6c59 | 75 | |
el18jgb | 22:7406068f6c59 | 76 | // Run the power up collison test |
el18jgb | 22:7406068f6c59 | 77 | printf("Testing collision_pup_test ...\n"); |
el18jgb | 22:7406068f6c59 | 78 | bool test_passed5 = collision_pup_test(); |
el18jgb | 22:7406068f6c59 | 79 | |
el18jgb | 22:7406068f6c59 | 80 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 81 | if (test_passed5) { |
el18jgb | 22:7406068f6c59 | 82 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 83 | } |
el18jgb | 22:7406068f6c59 | 84 | else { |
el18jgb | 22:7406068f6c59 | 85 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 86 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 87 | } |
el18jgb | 22:7406068f6c59 | 88 | |
el18jgb | 22:7406068f6c59 | 89 | //sd card protection |
el18jgb | 22:7406068f6c59 | 90 | int protect = hs.geths(sd); |
el18jgb | 22:7406068f6c59 | 91 | |
el18jgb | 22:7406068f6c59 | 92 | // Run highscore test |
el18jgb | 22:7406068f6c59 | 93 | printf("Testing highscore_test ...\n"); |
el18jgb | 22:7406068f6c59 | 94 | bool test_passed6 = highscore_test(sd); |
el18jgb | 22:7406068f6c59 | 95 | |
el18jgb | 22:7406068f6c59 | 96 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 97 | if (test_passed6) { |
el18jgb | 13:cfdfe60a2327 | 98 | printf("...Passed!\n"); |
el18jgb | 13:cfdfe60a2327 | 99 | } |
el18jgb | 13:cfdfe60a2327 | 100 | else { |
el18jgb | 13:cfdfe60a2327 | 101 | printf("...FAILED!\n"); |
el18jgb | 13:cfdfe60a2327 | 102 | ++n_tests_failed; // Increment number of failures |
el18jgb | 13:cfdfe60a2327 | 103 | } |
el18jgb | 13:cfdfe60a2327 | 104 | |
el18jgb | 22:7406068f6c59 | 105 | hs.seths(sd, protect);//rewrites highscore that was on card if ran with tests |
el18jgb | 22:7406068f6c59 | 106 | |
el18jgb | 22:7406068f6c59 | 107 | // Run menu test |
el18jgb | 22:7406068f6c59 | 108 | printf("Testing menu_test ...\n"); |
el18jgb | 22:7406068f6c59 | 109 | bool test_passed7 = menu_test(); |
el18jgb | 22:7406068f6c59 | 110 | |
el18jgb | 22:7406068f6c59 | 111 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 112 | if (test_passed7) { |
el18jgb | 22:7406068f6c59 | 113 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 114 | } |
el18jgb | 22:7406068f6c59 | 115 | else { |
el18jgb | 22:7406068f6c59 | 116 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 117 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 118 | } |
el18jgb | 22:7406068f6c59 | 119 | |
el18jgb | 22:7406068f6c59 | 120 | // Run power up positioning test |
el18jgb | 22:7406068f6c59 | 121 | printf("Testing pup_test_double ...\n"); |
el18jgb | 22:7406068f6c59 | 122 | bool test_passed8 = pup_test_double(); |
el18jgb | 22:7406068f6c59 | 123 | |
el18jgb | 22:7406068f6c59 | 124 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 125 | if (test_passed8) { |
el18jgb | 22:7406068f6c59 | 126 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 127 | } |
el18jgb | 22:7406068f6c59 | 128 | else { |
el18jgb | 22:7406068f6c59 | 129 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 130 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 131 | } |
el18jgb | 22:7406068f6c59 | 132 | |
el18jgb | 22:7406068f6c59 | 133 | // Run spike updating y test |
el18jgb | 22:7406068f6c59 | 134 | printf("Testing spikes update y ...\n"); |
el18jgb | 22:7406068f6c59 | 135 | bool test_passed9 = spikes_test_updatey(); |
el18jgb | 22:7406068f6c59 | 136 | |
el18jgb | 22:7406068f6c59 | 137 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 138 | if (test_passed9) { |
el18jgb | 22:7406068f6c59 | 139 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 140 | } |
el18jgb | 22:7406068f6c59 | 141 | else { |
el18jgb | 22:7406068f6c59 | 142 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 143 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 144 | } |
el18jgb | 22:7406068f6c59 | 145 | |
el18jgb | 22:7406068f6c59 | 146 | // Run spike updating x test |
el18jgb | 22:7406068f6c59 | 147 | printf("Testing spikes update x ...\n"); |
el18jgb | 22:7406068f6c59 | 148 | bool test_passed10 = spikes_test_updatex(); |
el18jgb | 22:7406068f6c59 | 149 | |
el18jgb | 22:7406068f6c59 | 150 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 151 | if (test_passed10) { |
el18jgb | 22:7406068f6c59 | 152 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 153 | } |
el18jgb | 22:7406068f6c59 | 154 | else { |
el18jgb | 22:7406068f6c59 | 155 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 156 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 157 | } |
el18jgb | 22:7406068f6c59 | 158 | |
el18jgb | 22:7406068f6c59 | 159 | // Run spike updating x negativly test |
el18jgb | 22:7406068f6c59 | 160 | printf("Testing spike update negative x...\n"); |
el18jgb | 22:7406068f6c59 | 161 | bool test_passed11 = spikes_test_updatexn(); |
el18jgb | 22:7406068f6c59 | 162 | |
el18jgb | 22:7406068f6c59 | 163 | // Print out the result of this test |
el18jgb | 22:7406068f6c59 | 164 | if (test_passed11) { |
el18jgb | 22:7406068f6c59 | 165 | printf("...Passed!\n"); |
el18jgb | 22:7406068f6c59 | 166 | } |
el18jgb | 22:7406068f6c59 | 167 | else { |
el18jgb | 22:7406068f6c59 | 168 | printf("...FAILED!\n"); |
el18jgb | 22:7406068f6c59 | 169 | ++n_tests_failed; // Increment number of failures |
el18jgb | 22:7406068f6c59 | 170 | } |
el18jgb | 13:cfdfe60a2327 | 171 | // Repeat the above for each testing function... |
el18jgb | 13:cfdfe60a2327 | 172 | // ... |
el18jgb | 13:cfdfe60a2327 | 173 | // ... |
el18jgb | 13:cfdfe60a2327 | 174 | |
el18jgb | 13:cfdfe60a2327 | 175 | // Finish by printing a summary of the tests |
el18jgb | 13:cfdfe60a2327 | 176 | if (n_tests_failed > 0) { |
el18jgb | 13:cfdfe60a2327 | 177 | printf("%d tests FAILED!\n", n_tests_failed); |
el18jgb | 13:cfdfe60a2327 | 178 | } |
el18jgb | 13:cfdfe60a2327 | 179 | else { |
el18jgb | 13:cfdfe60a2327 | 180 | printf("All tests passed!\n"); |
el18jgb | 13:cfdfe60a2327 | 181 | } |
el18jgb | 13:cfdfe60a2327 | 182 | |
el18jgb | 13:cfdfe60a2327 | 183 | return n_tests_failed; |
el18jgb | 13:cfdfe60a2327 | 184 | } |
el18jgb | 13:cfdfe60a2327 | 185 | |
el18jgb | 13:cfdfe60a2327 | 186 | #endif |