![](/media/cache/profiles/LinkedIn_0NghoZJ.jpeg.50x50_q85.jpg)
Snake vs Block Game to be run upon K64F.
Diff: StartScreen/StartScreen.cpp
- Revision:
- 16:7b474f873683
- Parent:
- 15:f4d069da093d
- Child:
- 18:b391caa5754c
--- a/StartScreen/StartScreen.cpp Thu Apr 04 18:50:40 2019 +0000 +++ b/StartScreen/StartScreen.cpp Fri Apr 05 05:46:11 2019 +0000 @@ -115,6 +115,7 @@ int st=1; int sc=1; float cs = 4; + StartScreen::StartScreen() { @@ -238,7 +239,7 @@ ani+=3; lcd.refresh(); pad.tone(370,0.1); - wait(0.2); + wait(0.3); pad.leds_off(); lcd.clear(); } @@ -250,6 +251,7 @@ lcd.printString("Start",25,3); lcd.printString("to Begin",15,5); lcd.refresh(); + wait(1/cs); while ( pad.check_event(Gamepad::START_PRESSED) == false) { pad.leds_on(); wait(0.1); @@ -279,6 +281,7 @@ lcd.clear(); wait(1/cs); lcd.drawSprite(50,i,7,9,(int *)arrow); + wait(1/cs); while ((pad.check_event(Gamepad::JOY_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. lcd.printString("SnakeVSBlock",5,0); lcd.printString("Play",0,2); @@ -307,7 +310,7 @@ { lcd.clear(); settings.info(lcd, pad); - + wait(1/cs); while (pad.check_event(Gamepad::BACK_PRESSED) == false) { //if button pressed. Direction d = pad.get_direction(); @@ -378,8 +381,7 @@ void StartScreen::menu_screen2(N5110 &lcd, Gamepad &pad) { lcd.clear(); - wait(1/cs); - + wait(2/cs); while ((pad.check_event(Gamepad::JOY_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed. Direction d = pad.get_direction(); @@ -410,6 +412,7 @@ lcd.drawSprite(29,19,13,5,(int *)bullet); //Function used to draw the sprite. lcd.refresh(); } + wait(1/cs); if (pad.check_event(Gamepad::BACK_PRESSED) == true) { lcd.clear(); pad.tone(1000.0,0.1); @@ -454,6 +457,7 @@ lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. lcd.printString("Game Speed",10,1); lcd.printString("SNAIL",26,3); + fps = 15; lcd.refresh(); } if(gs==2) { @@ -462,6 +466,7 @@ lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. lcd.printString("Game Speed",10,1); lcd.printString("TURTLE",24,3); + fps = 25; lcd.refresh(); } if(gs==3) { @@ -470,6 +475,7 @@ lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. lcd.printString("Game Speed",10,1); lcd.printString("RABBIT",24,3); + fps = 40; lcd.refresh(); } if(gs==4) { @@ -478,6 +484,7 @@ lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite. lcd.printString("Game Speed",10,1); lcd.printString("CHEETHA",21,3); + fps = 65; lcd.refresh(); }