Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Wed Apr 17 07:47:06 2019 +0000
Revision:
33:249cf423fb18
Parent:
32:3a3bdeffdf62
Child:
34:89f53ffc81bb
Added Stats Class and now i can store the highest level.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AhmedPlaymaker 3:fbb1fa853f09 1 #include "StartScreen.h"
AhmedPlaymaker 5:e4df87957a5b 2 Settings settings;
AhmedPlaymaker 3:fbb1fa853f09 3
AhmedPlaymaker 3:fbb1fa853f09 4 int sprite[48][84] = {
AhmedPlaymaker 6:3ffab44ed49c 5 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
AhmedPlaymaker 6:3ffab44ed49c 6 {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
AhmedPlaymaker 6:3ffab44ed49c 7 {1,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
AhmedPlaymaker 6:3ffab44ed49c 8 {1,0,0,0,0,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,1,1,1,1,0,1,1,1,0,0,0,1,1,1,1,0,1,1,0,0,1,1,0,1},
AhmedPlaymaker 6:3ffab44ed49c 51 {1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1},
AhmedPlaymaker 6:3ffab44ed49c 52 {1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1},
AhmedPlaymaker 3:fbb1fa853f09 53
AhmedPlaymaker 4:1fe015b66bb8 54 };
AhmedPlaymaker 3:fbb1fa853f09 55
AhmedPlaymaker 4:1fe015b66bb8 56 int arrow[7][9] = {
AhmedPlaymaker 3:fbb1fa853f09 57 {0,0,0,0,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 58 {0,0,0,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 59 {0,0,1,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 60 {0,1,1,1,1,1,1,1,1},
AhmedPlaymaker 3:fbb1fa853f09 61 {0,0,1,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 62 {0,0,0,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 63 {0,0,0,0,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 64 };
AhmedPlaymaker 4:1fe015b66bb8 65
AhmedPlaymaker 4:1fe015b66bb8 66 int bullet[13][5] = {
AhmedPlaymaker 4:1fe015b66bb8 67 {1,0,0,0,1},
AhmedPlaymaker 4:1fe015b66bb8 68 {1,0,0,0,1},
AhmedPlaymaker 4:1fe015b66bb8 69 {0,1,0,1,0},
AhmedPlaymaker 4:1fe015b66bb8 70 {0,0,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 71 {0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 72 {0,0,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 73 {0,0,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 74 {0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 75 {0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 76 {0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 77 {0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 78 {0,0,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 79 {0,0,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 80 };
AhmedPlaymaker 4:1fe015b66bb8 81 int navL[13][8] = {
AhmedPlaymaker 4:1fe015b66bb8 82 {0,0,0,0,0,0,1,1},
AhmedPlaymaker 4:1fe015b66bb8 83 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 4:1fe015b66bb8 84 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 85 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 86 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 87 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 88 {1,1,0,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 89 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 90 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 91 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 92 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 93 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 4:1fe015b66bb8 94 {0,0,0,0,0,0,1,1},
AhmedPlaymaker 4:1fe015b66bb8 95 };
AhmedPlaymaker 3:fbb1fa853f09 96
AhmedPlaymaker 4:1fe015b66bb8 97 int navR[13][8] = {
AhmedPlaymaker 4:1fe015b66bb8 98 {1,1,0,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 99 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 100 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 101 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 102 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 103 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 4:1fe015b66bb8 104 {0,0,0,0,0,0,1,1},
AhmedPlaymaker 4:1fe015b66bb8 105 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 4:1fe015b66bb8 106 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 107 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 108 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 109 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 110 {1,1,0,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 111 };
AhmedPlaymaker 16:7b474f873683 112
AhmedPlaymaker 3:fbb1fa853f09 113 StartScreen::StartScreen()
AhmedPlaymaker 3:fbb1fa853f09 114 {
AhmedPlaymaker 3:fbb1fa853f09 115
AhmedPlaymaker 3:fbb1fa853f09 116 }
AhmedPlaymaker 3:fbb1fa853f09 117
AhmedPlaymaker 3:fbb1fa853f09 118 StartScreen::~StartScreen()
AhmedPlaymaker 3:fbb1fa853f09 119 {
AhmedPlaymaker 3:fbb1fa853f09 120
AhmedPlaymaker 3:fbb1fa853f09 121 }
AhmedPlaymaker 3:fbb1fa853f09 122
AhmedPlaymaker 30:461231877c89 123 void StartScreen::init()
AhmedPlaymaker 30:461231877c89 124 {
AhmedPlaymaker 30:461231877c89 125 i = 16;
AhmedPlaymaker 30:461231877c89 126 lr = 1;
AhmedPlaymaker 30:461231877c89 127 gs = 1;
AhmedPlaymaker 30:461231877c89 128 st = 1;
AhmedPlaymaker 30:461231877c89 129 sc = 1;
AhmedPlaymaker 30:461231877c89 130 cs = 4;
AhmedPlaymaker 30:461231877c89 131 }
AhmedPlaymaker 3:fbb1fa853f09 132
AhmedPlaymaker 3:fbb1fa853f09 133 void StartScreen::screen_saver(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 3:fbb1fa853f09 134 {
AhmedPlaymaker 28:d2c621d67e3b 135 //this saves the Theme song I want to play at the start.
AhmedPlaymaker 32:3a3bdeffdf62 136 StartScreen::init();
AhmedPlaymaker 26:3495f7b0ede7 137 int song[18] = {441,494,439,372,392,370,330,246,329,331,370,555,555,495,440,392,392,370};
AhmedPlaymaker 6:3ffab44ed49c 138 pad.leds_on();
AhmedPlaymaker 26:3495f7b0ede7 139
AhmedPlaymaker 28:d2c621d67e3b 140 for(int ani = -51; ani <= 0; ani+=3) {
AhmedPlaymaker 26:3495f7b0ede7 141 lcd.clear();
AhmedPlaymaker 26:3495f7b0ede7 142 lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
AhmedPlaymaker 26:3495f7b0ede7 143 lcd.refresh();
AhmedPlaymaker 26:3495f7b0ede7 144 pad.tone(song[(ani+48)/3],0.1);
AhmedPlaymaker 26:3495f7b0ede7 145 wait(0.2);
AhmedPlaymaker 26:3495f7b0ede7 146 }
AhmedPlaymaker 26:3495f7b0ede7 147
AhmedPlaymaker 16:7b474f873683 148 wait(0.3);
AhmedPlaymaker 3:fbb1fa853f09 149 pad.leds_off();
AhmedPlaymaker 3:fbb1fa853f09 150 lcd.clear();
AhmedPlaymaker 3:fbb1fa853f09 151 }
AhmedPlaymaker 3:fbb1fa853f09 152
AhmedPlaymaker 3:fbb1fa853f09 153 void StartScreen::instruct(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 3:fbb1fa853f09 154 {
AhmedPlaymaker 3:fbb1fa853f09 155 lcd.printString("Please Press",5,1); //Function used to promt the user to start.
AhmedPlaymaker 3:fbb1fa853f09 156 lcd.printString("Start",25,3);
AhmedPlaymaker 3:fbb1fa853f09 157 lcd.printString("to Begin",15,5);
AhmedPlaymaker 3:fbb1fa853f09 158 lcd.refresh();
AhmedPlaymaker 30:461231877c89 159 pad.init();
AhmedPlaymaker 3:fbb1fa853f09 160 while ( pad.check_event(Gamepad::START_PRESSED) == false) {
AhmedPlaymaker 3:fbb1fa853f09 161 pad.leds_on();
AhmedPlaymaker 3:fbb1fa853f09 162 wait(0.1);
AhmedPlaymaker 3:fbb1fa853f09 163 pad.leds_off();
AhmedPlaymaker 3:fbb1fa853f09 164 wait(0.1);
AhmedPlaymaker 3:fbb1fa853f09 165 }
AhmedPlaymaker 6:3ffab44ed49c 166 pad.tone(1000.0,0.1);
AhmedPlaymaker 3:fbb1fa853f09 167 lcd.clear();
AhmedPlaymaker 3:fbb1fa853f09 168 pad.leds_off();
AhmedPlaymaker 3:fbb1fa853f09 169 }
AhmedPlaymaker 3:fbb1fa853f09 170
AhmedPlaymaker 3:fbb1fa853f09 171 void StartScreen::info(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 3:fbb1fa853f09 172 {
AhmedPlaymaker 5:e4df87957a5b 173 if(sc ==1) {
AhmedPlaymaker 5:e4df87957a5b 174 lcd.printString("Created BY",8,1);
AhmedPlaymaker 5:e4df87957a5b 175 lcd.printString("Ahmed",24,3);
AhmedPlaymaker 5:e4df87957a5b 176 lcd.printString("Adamjee",20,4);
AhmedPlaymaker 5:e4df87957a5b 177 lcd.printString("201161436",15,5);
AhmedPlaymaker 5:e4df87957a5b 178 lcd.refresh();
AhmedPlaymaker 5:e4df87957a5b 179 wait(2);
AhmedPlaymaker 5:e4df87957a5b 180 }
AhmedPlaymaker 3:fbb1fa853f09 181 lcd.clear();
AhmedPlaymaker 3:fbb1fa853f09 182 }
AhmedPlaymaker 3:fbb1fa853f09 183
AhmedPlaymaker 33:249cf423fb18 184 void StartScreen::main_menu(N5110 &lcd, Gamepad &pad, SDFileSystem &sd)
AhmedPlaymaker 3:fbb1fa853f09 185 {
AhmedPlaymaker 7:48ba87cd79b5 186 lcd.clear();
AhmedPlaymaker 30:461231877c89 187 StartScreen::init();
AhmedPlaymaker 32:3a3bdeffdf62 188 pad.init();
AhmedPlaymaker 29:c6358c39a70e 189 while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed.
AhmedPlaymaker 30:461231877c89 190 StartScreen::DisplaySc1Contents(lcd, pad);
AhmedPlaymaker 3:fbb1fa853f09 191 }
AhmedPlaymaker 6:3ffab44ed49c 192 pad.tone(1000.0,0.1);
AhmedPlaymaker 30:461231877c89 193 wait(1/cs);
AhmedPlaymaker 33:249cf423fb18 194 if(i == 16) {
AhmedPlaymaker 33:249cf423fb18 195 game_mode(lcd, pad, sd);
AhmedPlaymaker 4:1fe015b66bb8 196 }
AhmedPlaymaker 33:249cf423fb18 197 else if(i == 24) {
AhmedPlaymaker 30:461231877c89 198 float *cs_sc;
AhmedPlaymaker 30:461231877c89 199 cs_sc = settings.Implement(lcd, pad, st, cs);
AhmedPlaymaker 30:461231877c89 200 pad.tone(1000.0,0.1);
AhmedPlaymaker 30:461231877c89 201 cs = cs_sc[0];
AhmedPlaymaker 30:461231877c89 202 sc = cs_sc[1];
AhmedPlaymaker 33:249cf423fb18 203 main_menu(lcd, pad, sd);
AhmedPlaymaker 33:249cf423fb18 204 }
AhmedPlaymaker 33:249cf423fb18 205 else if(i == 32) {
AhmedPlaymaker 33:249cf423fb18 206 _stats.StatsDisplay(lcd, pad, sd);
AhmedPlaymaker 33:249cf423fb18 207 pad.tone(1000.0,0.1);
AhmedPlaymaker 33:249cf423fb18 208 main_menu(lcd, pad, sd);
AhmedPlaymaker 33:249cf423fb18 209 }
AhmedPlaymaker 33:249cf423fb18 210 else {
AhmedPlaymaker 33:249cf423fb18 211 main_menu(lcd, pad, sd);
AhmedPlaymaker 4:1fe015b66bb8 212 lr=1;
AhmedPlaymaker 4:1fe015b66bb8 213 }
AhmedPlaymaker 3:fbb1fa853f09 214 }
AhmedPlaymaker 30:461231877c89 215
AhmedPlaymaker 30:461231877c89 216 void StartScreen::DisplaySc1Contents(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 30:461231877c89 217 {
AhmedPlaymaker 30:461231877c89 218 lcd.printString("SnakeVSBlock",5,0);
AhmedPlaymaker 30:461231877c89 219 lcd.printString("Play",0,2);
AhmedPlaymaker 30:461231877c89 220 lcd.printString("Settings",0,3);
AhmedPlaymaker 30:461231877c89 221 lcd.printString("Stats",0,4);
AhmedPlaymaker 30:461231877c89 222 lcd.printString("Tutorial",0,5);
AhmedPlaymaker 30:461231877c89 223 Direction d = pad.get_direction();
AhmedPlaymaker 30:461231877c89 224 if((d==N)&&(i>16)) {
AhmedPlaymaker 30:461231877c89 225 i=i-8;
AhmedPlaymaker 30:461231877c89 226 }
AhmedPlaymaker 30:461231877c89 227 if((d==S)&&(i<40)) {
AhmedPlaymaker 30:461231877c89 228 i=i+8;
AhmedPlaymaker 30:461231877c89 229 }
AhmedPlaymaker 30:461231877c89 230 lcd.drawSprite(50,i,7,9,(int *)arrow); //Function used to draw the sprite.
AhmedPlaymaker 30:461231877c89 231 lcd.refresh();
AhmedPlaymaker 30:461231877c89 232 wait(1/cs);
AhmedPlaymaker 30:461231877c89 233 lcd.clear();
AhmedPlaymaker 30:461231877c89 234 }
AhmedPlaymaker 30:461231877c89 235
AhmedPlaymaker 33:249cf423fb18 236 void StartScreen::game_mode(N5110 &lcd, Gamepad &pad, SDFileSystem &sd)
AhmedPlaymaker 4:1fe015b66bb8 237 {
AhmedPlaymaker 4:1fe015b66bb8 238 lcd.clear();
AhmedPlaymaker 16:7b474f873683 239 wait(2/cs);
AhmedPlaymaker 30:461231877c89 240 pad.init();
AhmedPlaymaker 29:c6358c39a70e 241 while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed.
AhmedPlaymaker 29:c6358c39a70e 242
AhmedPlaymaker 4:1fe015b66bb8 243 Direction d = pad.get_direction();
AhmedPlaymaker 29:c6358c39a70e 244 wait(1/cs);
AhmedPlaymaker 4:1fe015b66bb8 245 if(((d==E)||(d==W))&&(lr==1)) {
AhmedPlaymaker 4:1fe015b66bb8 246 lr=2;
AhmedPlaymaker 4:1fe015b66bb8 247 }
AhmedPlaymaker 4:1fe015b66bb8 248
AhmedPlaymaker 4:1fe015b66bb8 249 else if(((d==E)||(d==W))&&(lr==2)) {
AhmedPlaymaker 4:1fe015b66bb8 250 lr=1;
AhmedPlaymaker 4:1fe015b66bb8 251 }
AhmedPlaymaker 29:c6358c39a70e 252 lcd.clear();
AhmedPlaymaker 29:c6358c39a70e 253 lcd.drawRect(27,18,30,20,FILL_TRANSPARENT);
AhmedPlaymaker 29:c6358c39a70e 254 lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
AhmedPlaymaker 29:c6358c39a70e 255 lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
AhmedPlaymaker 4:1fe015b66bb8 256 if(lr==1) {
AhmedPlaymaker 4:1fe015b66bb8 257 lcd.printString("Free Wave",14,1);
AhmedPlaymaker 4:1fe015b66bb8 258 lcd.refresh();
AhmedPlaymaker 4:1fe015b66bb8 259 }
AhmedPlaymaker 4:1fe015b66bb8 260 if(lr==2) {
AhmedPlaymaker 4:1fe015b66bb8 261 lcd.printString("Bullet Shower",4,1);
AhmedPlaymaker 4:1fe015b66bb8 262 lcd.drawSprite(29,19,13,5,(int *)bullet); //Function used to draw the sprite.
AhmedPlaymaker 4:1fe015b66bb8 263 }
AhmedPlaymaker 29:c6358c39a70e 264 if (pad.check_event(Gamepad::BACK_PRESSED) == true) {
AhmedPlaymaker 9:d1d79d4ee673 265 pad.tone(1000.0,0.1);
AhmedPlaymaker 33:249cf423fb18 266 main_menu(lcd, pad, sd);
AhmedPlaymaker 26:3495f7b0ede7 267 }
AhmedPlaymaker 26:3495f7b0ede7 268 lcd.refresh();
AhmedPlaymaker 4:1fe015b66bb8 269 }
AhmedPlaymaker 33:249cf423fb18 270 gs = 1;
AhmedPlaymaker 6:3ffab44ed49c 271 pad.tone(1000.0,0.1);
AhmedPlaymaker 4:1fe015b66bb8 272 lcd.clear();
AhmedPlaymaker 33:249cf423fb18 273 game_speed(lcd, pad, sd);
AhmedPlaymaker 4:1fe015b66bb8 274 }
AhmedPlaymaker 33:249cf423fb18 275 void StartScreen::game_speed(N5110 &lcd, Gamepad &pad, SDFileSystem &sd)
AhmedPlaymaker 4:1fe015b66bb8 276 {
AhmedPlaymaker 4:1fe015b66bb8 277 lcd.clear();
AhmedPlaymaker 29:c6358c39a70e 278 wait(2/cs);
AhmedPlaymaker 30:461231877c89 279 pad.init();
AhmedPlaymaker 29:c6358c39a70e 280 while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed.
AhmedPlaymaker 30:461231877c89 281
AhmedPlaymaker 4:1fe015b66bb8 282 Direction d = pad.get_direction();
AhmedPlaymaker 5:e4df87957a5b 283 wait(1/cs);
AhmedPlaymaker 4:1fe015b66bb8 284 if((d==E)&&(gs==4)) {
AhmedPlaymaker 4:1fe015b66bb8 285 gs=1;
AhmedPlaymaker 4:1fe015b66bb8 286 }
AhmedPlaymaker 4:1fe015b66bb8 287 else if((d==W)&&(gs==1)) {
AhmedPlaymaker 4:1fe015b66bb8 288 gs=4;
AhmedPlaymaker 4:1fe015b66bb8 289 }
AhmedPlaymaker 4:1fe015b66bb8 290 else if((d==E)&&(1<=gs<=3)) {
AhmedPlaymaker 4:1fe015b66bb8 291 gs=gs+1;
AhmedPlaymaker 4:1fe015b66bb8 292 }
AhmedPlaymaker 4:1fe015b66bb8 293 else if((d==W)&&(2<=gs<=4)) {
AhmedPlaymaker 4:1fe015b66bb8 294 gs=gs-1;
AhmedPlaymaker 4:1fe015b66bb8 295 }
AhmedPlaymaker 26:3495f7b0ede7 296 lcd.clear();
AhmedPlaymaker 26:3495f7b0ede7 297 lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
AhmedPlaymaker 26:3495f7b0ede7 298 lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
AhmedPlaymaker 26:3495f7b0ede7 299 lcd.printString("Game Speed",10,1);
AhmedPlaymaker 4:1fe015b66bb8 300 if(gs==1) {
AhmedPlaymaker 4:1fe015b66bb8 301 lcd.printString("SNAIL",26,3);
AhmedPlaymaker 29:c6358c39a70e 302 fps = 12;
AhmedPlaymaker 4:1fe015b66bb8 303 }
AhmedPlaymaker 4:1fe015b66bb8 304 if(gs==2) {
AhmedPlaymaker 4:1fe015b66bb8 305 lcd.printString("TURTLE",24,3);
AhmedPlaymaker 19:05cc9f801468 306 fps = 18;
AhmedPlaymaker 4:1fe015b66bb8 307 }
AhmedPlaymaker 4:1fe015b66bb8 308 if(gs==3) {
AhmedPlaymaker 4:1fe015b66bb8 309 lcd.printString("RABBIT",24,3);
AhmedPlaymaker 29:c6358c39a70e 310 fps = 22;
AhmedPlaymaker 4:1fe015b66bb8 311 }
AhmedPlaymaker 4:1fe015b66bb8 312 if(gs==4) {
AhmedPlaymaker 4:1fe015b66bb8 313 lcd.printString("CHEETHA",21,3);
AhmedPlaymaker 29:c6358c39a70e 314 fps = 27;
AhmedPlaymaker 4:1fe015b66bb8 315 }
AhmedPlaymaker 4:1fe015b66bb8 316
AhmedPlaymaker 4:1fe015b66bb8 317 if (pad.check_event(Gamepad::BACK_PRESSED) == true) {
AhmedPlaymaker 9:d1d79d4ee673 318 pad.tone(1000.0,0.1);
AhmedPlaymaker 33:249cf423fb18 319 game_mode(lcd, pad, sd);
AhmedPlaymaker 4:1fe015b66bb8 320 }
AhmedPlaymaker 26:3495f7b0ede7 321 lcd.refresh();
AhmedPlaymaker 4:1fe015b66bb8 322 }
AhmedPlaymaker 4:1fe015b66bb8 323
AhmedPlaymaker 6:3ffab44ed49c 324 pad.tone(1000.0,0.1);
AhmedPlaymaker 4:1fe015b66bb8 325 lcd.clear();
AhmedPlaymaker 5:e4df87957a5b 326 wait(1/cs);
AhmedPlaymaker 26:3495f7b0ede7 327 lcd.printString("Level:",25,1); //created so that the gamer can keep track of their game. //change this to be operated remotely
AhmedPlaymaker 21:e41126528cc6 328 lcd.printString("1",40,3);
AhmedPlaymaker 21:e41126528cc6 329 lcd.refresh();
AhmedPlaymaker 21:e41126528cc6 330 wait(2);
AhmedPlaymaker 4:1fe015b66bb8 331 }