Game codes for Pokemon Academy Yiu Fai Kwok - 201198802 I have read the University Regulations on Plagiarism and state that the work covered by this declaration is my own and does not contain any unacknowledged work from other sources.
Dependencies: mbed FXOS8700CQ mbed-rtos
Diff: Exam/Exam.cpp
- Revision:
- 8:d707bb3b9106
- Parent:
- 5:bc0691d02fd5
- Child:
- 10:adff3c804985
--- a/Exam/Exam.cpp Mon Apr 08 00:41:25 2019 +0000 +++ b/Exam/Exam.cpp Thu Apr 11 16:08:26 2019 +0000 @@ -61,7 +61,6 @@ switch (currentPage) { case PAGE_1: lcd.clear(); - lcd.printString("Question 1",0,0); lcd.printString("What is the",0,1); lcd.printString("cut off",0,2); @@ -75,7 +74,6 @@ break; case PAGE_2: lcd.clear(); - lcd.printString("formed by a",0,0); lcd.printString("50k resistor",0,1); lcd.printString("and capacitor",0,2); @@ -89,7 +87,6 @@ break; case PAGE_3: lcd.clear(); - pad.init(); if (point > 0){ lcd.printString("A. 26.5kHz",0,2); lcd.printString("B. 2.61MHz",0,3); @@ -104,7 +101,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_2;} if(pad.check_event(Gamepad::A_PRESSED) == true){ score++; @@ -119,7 +115,6 @@ break; case PAGE_4: lcd.clear(); - lcd.printString("Question 2",0,0); lcd.printString("What is the",0,1); lcd.printString("integration",0,2); @@ -133,7 +128,6 @@ break; case PAGE_5: lcd.clear(); - lcd.printString("with respect",0,0); lcd.printString("to x for ",0,1); lcd.printString("[0,pi/2]?",0,2); @@ -145,7 +139,6 @@ break; case PAGE_6: lcd.clear(); - pad.init(); if(point > 1) { lcd.printString("A. 0.1354",0,2); lcd.printString("B. 2.617",0,3); @@ -160,7 +153,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_5;} if(pad.check_event(Gamepad::Y_PRESSED) == true){ score++; @@ -175,7 +167,6 @@ break; case PAGE_7: lcd.clear(); - lcd.printString("Question 3",0,0); lcd.printString("What is the",0,1); lcd.printString("integration",0,2); @@ -189,7 +180,6 @@ break; case PAGE_8: lcd.clear(); - lcd.printString("with respect",0,0); lcd.printString("to x?",0,1); lcd.drawSprite(39, 44, 4, 7, down); @@ -200,7 +190,6 @@ break; case PAGE_9: pad.init(); - lcd.clear(); if(point > 2) { lcd.printString("A. -ln|cos(x)|",0,2); lcd.printString("B. -arctan(x)",0,3); @@ -215,7 +204,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_8;} if(pad.check_event(Gamepad::A_PRESSED) == true){ score++; @@ -230,7 +218,6 @@ break; case PAGE_10: lcd.clear(); - lcd.printString("EXAM",0,0); lcd.printString("COMPLETE",0,1); lcd.printString("PRESS START",0,5); @@ -267,7 +254,6 @@ //music.gym(pad, !finished); switch (currentPage) { case PAGE_1: - lcd.clear(); lcd.printString("Question 1",0,0); lcd.printString("A GaAs LED",0,1); @@ -281,7 +267,6 @@ wait(2.0f/fps); break; case PAGE_2: - lcd.clear(); lcd.printString("the longest",0,0); lcd.printString("wavelength",0,1); @@ -295,7 +280,6 @@ wait(2.0f/fps); break; case PAGE_3: - pad.init(); lcd.clear(); if (point > 0){ lcd.printString("A. 913.52nm",0,2); @@ -311,7 +295,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_2;} if(pad.check_event(Gamepad::B_PRESSED) == true){ score++; @@ -326,7 +309,6 @@ break; case PAGE_4: lcd.clear(); - lcd.printString("Question 2",0,0); lcd.printString("If the control",0,1); lcd.printString("signal for",0,2); @@ -340,7 +322,6 @@ break; case PAGE_5: lcd.clear(); - lcd.printString("t(on) = 70us",0,0); lcd.printString("t(off) = 30us",0,1); lcd.printString("what is the",0,2); @@ -353,7 +334,6 @@ wait(2.0f/fps); break; case PAGE_6: - pad.init(); lcd.clear(); if(point > 1) { lcd.printString("A. 10kHz",0,2); @@ -369,7 +349,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_5;} if(pad.check_event(Gamepad::A_PRESSED) == true){ score++; @@ -397,7 +376,6 @@ break; case PAGE_8: lcd.clear(); - lcd.printString("is the value",0,0); lcd.printString("of x(-t+5) at",0,1); lcd.printString("t=0?",0,2); @@ -408,7 +386,6 @@ wait(2.0f/fps); break; case PAGE_9: - pad.init(); lcd.clear(); if(point > 2) { lcd.printString("A. x(0)",0,2); @@ -424,7 +401,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_8;} if(pad.check_event(Gamepad::Y_PRESSED) == true){ score++; @@ -476,7 +452,6 @@ switch (currentPage) { case PAGE_1: lcd.clear(); - if (point > 0){ lcd.printString("Question 1",0,0); lcd.printString("The answer is",0,1); @@ -495,7 +470,6 @@ wait(2.0f/fps); break; case PAGE_2: - pad.init(); lcd.clear(); if (point > 0){ lcd.printString("A. ",0,2); @@ -511,7 +485,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_1;} if(pad.check_event(Gamepad::A_PRESSED) == true){ score++; @@ -525,7 +498,6 @@ wait(2.0f/fps); break; case PAGE_3: - lcd.clear(); if (point > 1){ lcd.printString("Question 2",0,0); @@ -545,7 +517,6 @@ wait(2.0f/fps); break; case PAGE_4: - pad.init(); lcd.clear(); if (point > 1){ lcd.printString("A. ",0,2); @@ -561,7 +532,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_3;} if(pad.check_event(Gamepad::B_PRESSED) == true){ score++; @@ -575,7 +545,6 @@ wait(2.0f/fps); break; case PAGE_5: - lcd.clear(); if (point > 2){ lcd.printString("Question 3",0,0); @@ -595,7 +564,6 @@ wait(2.0f/fps); break; case PAGE_6: - pad.init(); lcd.clear(); if (point > 2){ lcd.printString("A. ",0,2); @@ -611,7 +579,6 @@ } lcd.drawSprite(39, 0, 4, 7, up); lcd.refresh(); - wait(2.0f/fps); if(pad.get_direction() == N){currentPage = PAGE_5;} if(pad.check_event(Gamepad::Y_PRESSED) == true){ score++; @@ -625,7 +592,6 @@ wait(2.0f/fps); break; case PAGE_7: - lcd.clear(); lcd.printString("EXAM",0,0); lcd.printString("COMPLETE",0,1);