Stick_Runner
Dependencies: FXOS8700CQ Gamepad N5110 SDFileSystem mbed
Revision 7:887651afda26, committed 2017-05-04
- Comitter:
- el15ss
- Date:
- Thu May 04 14:11:18 2017 +0000
- Parent:
- 6:bf601a65cb27
- Commit message:
- StickRunner v1.0
Changed in this revision
Character/Character.h | 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 |
diff -r bf601a65cb27 -r 887651afda26 Character/Character.h --- a/Character/Character.h Thu May 04 13:04:14 2017 +0000 +++ b/Character/Character.h Thu May 04 14:11:18 2017 +0000 @@ -4,7 +4,7 @@ #include "mbed.h" #include "N5110.h" #include "Gamepad.h" -#include "FXOS8700CQ.h" + /** Class Character @brief Class responsible for all the functionality of the charachter including intialization, drawing, moving and updating it
diff -r bf601a65cb27 -r 887651afda26 main.cpp --- a/main.cpp Thu May 04 13:04:14 2017 +0000 +++ b/main.cpp Thu May 04 14:11:18 2017 +0000 @@ -21,7 +21,7 @@ // highScore - to store high score int i,j,counter,highScore; -//To helo convert counter(int) to string to display on the screen +//To help convert counter(int) to string to display on the screen char score[50]; //Structs @@ -110,8 +110,8 @@ lcd.printString("Stick Runner! ",0,1); lcd.printString(" Press Start ",0,4); lcd.refresh(); - // pad.tone(1500.0,0.5); - // pad.tone(1500.0,0.5); + pad.tone(1500.0,0.5); + pad.tone(1500.0,0.5); //Flashes LEDS aslong as START is not pressed @@ -151,7 +151,7 @@ //Condition to start a new game if( pad.check_event(Gamepad::A_PRESSED) ) { - //pad.tone(1000.0,0.5); + pad.tone(1000.0,0.5); //Clear, refresh and intialize the game again so we can start a new game @@ -169,7 +169,7 @@ else if( pad.check_event(Gamepad::B_PRESSED) ) { - // pad.tone(1000.0,0.5); + pad.tone(1000.0,0.5); //Simply refreshes the page and continues from where the user left the game @@ -189,7 +189,7 @@ //To read the game instructions else if( pad.check_event(Gamepad::X_PRESSED) ) { - // pad.tone(1000.0,0.5); + pad.tone(1000.0,0.5); //fprintf("entering instructions when X is pressed from menu"); Instructions(); @@ -200,7 +200,7 @@ //To see the game high score else if( pad.check_event(Gamepad::Y_PRESSED) ) { - //pad.tone(1000.0,0.5); + pad.tone(1000.0,0.5); //fprintf("Displayibng highscore when Y is pressed from menu"); displayHighScore(); @@ -245,8 +245,7 @@ //fprintf("Calling UpdateCharacter from the game func to make it move"); c.updateCharacter(pad.get_direction(),pad.get_mag()); - //values = device.get_values(); - // c.accMove(values); + //Condition to ckeck if the user wants to pause the game if(pad.check_event(Gamepad::BACK_PRESSED)) @@ -401,7 +400,7 @@ - //pad.tone(1000.0,0.5); + pad.tone(1000.0,0.5); pad.init(); @@ -411,7 +410,7 @@ //fprintf("Counter converted to string %s",score); lcd.printString(score,0,2); - lcd.printString("GAME OVER!! ",0,0); + lcd.printString(" GAME OVER!! ",0,0); lcd.printString(" PRESS START ",0,5); @@ -447,7 +446,7 @@ lcd.clear(); - //Open file + if(highScore <= counter) { @@ -507,7 +506,7 @@ if( pad.check_event(Gamepad::BACK_PRESSED) ) { - //pad.tone(1000.0,0.5); + pad.tone(1000.0,0.5); i = false; //fprintf("menu called from instructions when back pressed");