Snake vs Block Game to be run upon K64F.

Dependencies:   mbed

Committer:
AhmedPlaymaker
Date:
Mon Apr 29 14:40:42 2019 +0000
Revision:
60:d3a9e0e4a0de
Parent:
59:c65a2e933c47
Child:
61:f3c402bc2ad0
Created Tutorials class and added some sprites in it i will use later to implement

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AhmedPlaymaker 3:fbb1fa853f09 1 #include "StartScreen.h"
AhmedPlaymaker 3:fbb1fa853f09 2
AhmedPlaymaker 3:fbb1fa853f09 3 int sprite[48][84] = {
AhmedPlaymaker 6:3ffab44ed49c 4 {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 5 {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 6 {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 7 {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,0,0,0,0,0,0,0,0,0,0,0,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1,1,1,1,0,1,1,0,0,1,1,0,1},
AhmedPlaymaker 6:3ffab44ed49c 50 {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 51 {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 52
AhmedPlaymaker 4:1fe015b66bb8 53 };
AhmedPlaymaker 3:fbb1fa853f09 54
AhmedPlaymaker 4:1fe015b66bb8 55 int arrow[7][9] = {
AhmedPlaymaker 3:fbb1fa853f09 56 {0,0,0,0,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 57 {0,0,0,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 58 {0,0,1,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 59 {0,1,1,1,1,1,1,1,1},
AhmedPlaymaker 3:fbb1fa853f09 60 {0,0,1,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 61 {0,0,0,1,1,0,0,0,0},
AhmedPlaymaker 3:fbb1fa853f09 62 {0,0,0,0,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 63 };
AhmedPlaymaker 4:1fe015b66bb8 64
AhmedPlaymaker 56:142e9fdb77a8 65 int motionControl[12][21] = {
AhmedPlaymaker 56:142e9fdb77a8 66 {0,0,0,0,0,0,0,1,1,1,1,1,1,1,0,0,0,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 67 {0,0,0,0,0,0,1,0,0,0,0,0,0,0,1,0,0,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 68 {0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 69 {0,0,0,0,0,1,0,0,0,1,1,1,0,0,0,1,0,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 70 {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 71 {0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 72 {1,1,1,0,1,0,0,1,1,1,1,1,1,1,0,0,1,0,1,1,1},
AhmedPlaymaker 56:142e9fdb77a8 73 {1,1,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,1,1},
AhmedPlaymaker 56:142e9fdb77a8 74 {1,0,1,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,1,0,1},
AhmedPlaymaker 56:142e9fdb77a8 75 {0,0,0,1,0,0,0,1,0,0,0,0,0,1,0,0,0,1,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 76 {0,0,0,0,1,0,1,0,0,0,0,0,0,0,1,0,1,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 77 {0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 78 };
AhmedPlaymaker 56:142e9fdb77a8 79
AhmedPlaymaker 57:845781aea5ec 80 int joystick[13][48] = {
AhmedPlaymaker 57:845781aea5ec 81 {0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,1,1,1,0,0,0,0,0,0},
AhmedPlaymaker 57:845781aea5ec 82 {0,0,0,0,0,1,1,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,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57:845781aea5ec 91 {0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,1,1,0,0,0,0},
AhmedPlaymaker 57:845781aea5ec 92 {0,0,0,0,0,1,1,0,0,0,0,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,0,0,0,0,0,1,1,0,0,0,0,0},
AhmedPlaymaker 57:845781aea5ec 93 {0,0,0,0,0,0,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,1,1,1,0,0,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 94 };
AhmedPlaymaker 56:142e9fdb77a8 95
AhmedPlaymaker 4:1fe015b66bb8 96 int navL[13][8] = {
AhmedPlaymaker 4:1fe015b66bb8 97 {0,0,0,0,0,0,1,1},
AhmedPlaymaker 4:1fe015b66bb8 98 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 4:1fe015b66bb8 99 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 100 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 101 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 102 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 56:142e9fdb77a8 103 {1,1,1,1,1,1,1,1},
AhmedPlaymaker 4:1fe015b66bb8 104 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 105 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 106 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 107 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 108 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 4:1fe015b66bb8 109 {0,0,0,0,0,0,1,1},
AhmedPlaymaker 4:1fe015b66bb8 110 };
AhmedPlaymaker 3:fbb1fa853f09 111
AhmedPlaymaker 4:1fe015b66bb8 112 int navR[13][8] = {
AhmedPlaymaker 4:1fe015b66bb8 113 {1,1,0,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 114 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 115 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 116 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 117 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 118 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 56:142e9fdb77a8 119 {1,1,1,1,1,1,1,1},
AhmedPlaymaker 4:1fe015b66bb8 120 {0,0,0,0,0,1,1,0},
AhmedPlaymaker 4:1fe015b66bb8 121 {0,0,0,0,1,1,0,0},
AhmedPlaymaker 4:1fe015b66bb8 122 {0,0,0,1,1,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 123 {0,0,1,1,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 124 {0,1,1,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 125 {1,1,0,0,0,0,0,0},
AhmedPlaymaker 4:1fe015b66bb8 126 };
AhmedPlaymaker 16:7b474f873683 127
AhmedPlaymaker 3:fbb1fa853f09 128 StartScreen::StartScreen()
AhmedPlaymaker 3:fbb1fa853f09 129 {
AhmedPlaymaker 3:fbb1fa853f09 130
AhmedPlaymaker 3:fbb1fa853f09 131 }
AhmedPlaymaker 3:fbb1fa853f09 132
AhmedPlaymaker 3:fbb1fa853f09 133 StartScreen::~StartScreen()
AhmedPlaymaker 3:fbb1fa853f09 134 {
AhmedPlaymaker 58:affb42c56cf8 135
AhmedPlaymaker 3:fbb1fa853f09 136 }
AhmedPlaymaker 3:fbb1fa853f09 137
AhmedPlaymaker 30:461231877c89 138 void StartScreen::init()
AhmedPlaymaker 30:461231877c89 139 {
AhmedPlaymaker 36:dfdd619874ae 140 i = 16; //main menu selection arrow position
AhmedPlaymaker 56:142e9fdb77a8 141 g_mode = 1; //game mode selection (joystick/motion control).
AhmedPlaymaker 47:b448ffd073e7 142 gs = 2; //game speed page selection.
AhmedPlaymaker 36:dfdd619874ae 143 st = 1; //this is the sr num of settings pages.
AhmedPlaymaker 36:dfdd619874ae 144 sc = 1; //this helps in wether ot not to show credits to the user.
AhmedPlaymaker 36:dfdd619874ae 145 cs = 4; //sensitivity of control speed of menu options.
AhmedPlaymaker 30:461231877c89 146 }
AhmedPlaymaker 3:fbb1fa853f09 147
AhmedPlaymaker 3:fbb1fa853f09 148 void StartScreen::screen_saver(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 3:fbb1fa853f09 149 {
AhmedPlaymaker 28:d2c621d67e3b 150 //this saves the Theme song I want to play at the start.
AhmedPlaymaker 26:3495f7b0ede7 151 int song[18] = {441,494,439,372,392,370,330,246,329,331,370,555,555,495,440,392,392,370};
AhmedPlaymaker 6:3ffab44ed49c 152 pad.leds_on();
AhmedPlaymaker 26:3495f7b0ede7 153
AhmedPlaymaker 28:d2c621d67e3b 154 for(int ani = -51; ani <= 0; ani+=3) {
AhmedPlaymaker 26:3495f7b0ede7 155 lcd.clear();
AhmedPlaymaker 26:3495f7b0ede7 156 lcd.drawSprite(0,ani,48,84,(int *)sprite); //Function used to draw the sprite
AhmedPlaymaker 26:3495f7b0ede7 157 lcd.refresh();
AhmedPlaymaker 26:3495f7b0ede7 158 pad.tone(song[(ani+48)/3],0.1);
AhmedPlaymaker 59:c65a2e933c47 159 Start_Pressed = 0;
AhmedPlaymaker 59:c65a2e933c47 160 if((pad.check_event(Gamepad::START_PRESSED) == true)||(pad.check_event(Gamepad::A_PRESSED) == true)) { //to allow the gamer to skip the long starting animation if they are not a fan.
AhmedPlaymaker 59:c65a2e933c47 161 Start_Pressed = 1;
AhmedPlaymaker 59:c65a2e933c47 162 break;
AhmedPlaymaker 59:c65a2e933c47 163 }
AhmedPlaymaker 26:3495f7b0ede7 164 wait(0.2);
AhmedPlaymaker 26:3495f7b0ede7 165 }
AhmedPlaymaker 59:c65a2e933c47 166 if (Start_Pressed == 0) { wait(0.3); } //dont wait anymore if start is pressed.
AhmedPlaymaker 3:fbb1fa853f09 167 pad.leds_off();
AhmedPlaymaker 3:fbb1fa853f09 168 lcd.clear();
AhmedPlaymaker 56:142e9fdb77a8 169
AhmedPlaymaker 56:142e9fdb77a8 170 StartScreen::instruct(lcd,pad); //after the screen_saver is displayed we need to send in instructions of how to preoceed to menu.
AhmedPlaymaker 3:fbb1fa853f09 171 }
AhmedPlaymaker 3:fbb1fa853f09 172
AhmedPlaymaker 3:fbb1fa853f09 173 void StartScreen::instruct(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 3:fbb1fa853f09 174 {
AhmedPlaymaker 30:461231877c89 175 pad.init();
AhmedPlaymaker 59:c65a2e933c47 176 while ((pad.check_event(Gamepad::START_PRESSED) == false)&&(pad.check_event(Gamepad::A_PRESSED) == false)&&(Start_Pressed == 0)) {
AhmedPlaymaker 59:c65a2e933c47 177 lcd.printString("Please Press",5,1); //Function used to promt the user to start.
AhmedPlaymaker 59:c65a2e933c47 178 lcd.printString("Start",25,3);
AhmedPlaymaker 59:c65a2e933c47 179 lcd.printString("to Begin",15,5);
AhmedPlaymaker 59:c65a2e933c47 180 lcd.refresh();
AhmedPlaymaker 3:fbb1fa853f09 181 pad.leds_on();
AhmedPlaymaker 3:fbb1fa853f09 182 wait(0.1);
AhmedPlaymaker 3:fbb1fa853f09 183 pad.leds_off();
AhmedPlaymaker 3:fbb1fa853f09 184 wait(0.1);
AhmedPlaymaker 3:fbb1fa853f09 185 }
AhmedPlaymaker 6:3ffab44ed49c 186 pad.tone(1000.0,0.1);
AhmedPlaymaker 3:fbb1fa853f09 187 lcd.clear();
AhmedPlaymaker 3:fbb1fa853f09 188 pad.leds_off();
AhmedPlaymaker 3:fbb1fa853f09 189 }
AhmedPlaymaker 3:fbb1fa853f09 190
AhmedPlaymaker 49:441c32f6603e 191 void StartScreen::credits(N5110 &lcd)
AhmedPlaymaker 3:fbb1fa853f09 192 {
AhmedPlaymaker 49:441c32f6603e 193 lcd.clear();
AhmedPlaymaker 49:441c32f6603e 194 if(sc) {
AhmedPlaymaker 5:e4df87957a5b 195 lcd.printString("Created BY",8,1);
AhmedPlaymaker 5:e4df87957a5b 196 lcd.printString("Ahmed",24,3);
AhmedPlaymaker 5:e4df87957a5b 197 lcd.printString("Adamjee",20,4);
AhmedPlaymaker 5:e4df87957a5b 198 lcd.printString("201161436",15,5);
AhmedPlaymaker 5:e4df87957a5b 199 lcd.refresh();
AhmedPlaymaker 5:e4df87957a5b 200 wait(2);
AhmedPlaymaker 5:e4df87957a5b 201 }
AhmedPlaymaker 3:fbb1fa853f09 202 lcd.clear();
AhmedPlaymaker 3:fbb1fa853f09 203 }
AhmedPlaymaker 3:fbb1fa853f09 204
AhmedPlaymaker 49:441c32f6603e 205 void StartScreen::read_stats(SDFileSystem &sd)
AhmedPlaymaker 49:441c32f6603e 206 {
AhmedPlaymaker 49:441c32f6603e 207 _stats.read(sd);
AhmedPlaymaker 49:441c32f6603e 208 }
AhmedPlaymaker 49:441c32f6603e 209
AhmedPlaymaker 49:441c32f6603e 210 void StartScreen::main_menu(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 3:fbb1fa853f09 211 {
AhmedPlaymaker 7:48ba87cd79b5 212 lcd.clear();
AhmedPlaymaker 52:c2faa96cf293 213 //StartScreen::init();
AhmedPlaymaker 32:3a3bdeffdf62 214 pad.init();
AhmedPlaymaker 29:c6358c39a70e 215 while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed.
AhmedPlaymaker 56:142e9fdb77a8 216 StartScreen::ImplementMenu(lcd, pad);
AhmedPlaymaker 3:fbb1fa853f09 217 }
AhmedPlaymaker 6:3ffab44ed49c 218 pad.tone(1000.0,0.1);
AhmedPlaymaker 30:461231877c89 219 wait(1/cs);
AhmedPlaymaker 56:142e9fdb77a8 220 StartScreen::NextMenu(lcd, pad);
AhmedPlaymaker 34:89f53ffc81bb 221 }
AhmedPlaymaker 34:89f53ffc81bb 222
AhmedPlaymaker 56:142e9fdb77a8 223 void StartScreen::ImplementMenu(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 34:89f53ffc81bb 224 {
AhmedPlaymaker 34:89f53ffc81bb 225 lcd.printString("SnakeVSBlock",5,0);
AhmedPlaymaker 34:89f53ffc81bb 226 lcd.printString("Play",0,2);
AhmedPlaymaker 34:89f53ffc81bb 227 lcd.printString("Settings",0,3);
AhmedPlaymaker 34:89f53ffc81bb 228 lcd.printString("Stats",0,4);
AhmedPlaymaker 34:89f53ffc81bb 229 lcd.printString("Tutorial",0,5);
AhmedPlaymaker 34:89f53ffc81bb 230 Direction d = pad.get_direction();
AhmedPlaymaker 59:c65a2e933c47 231 if(((d==N)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(i>16)) {
AhmedPlaymaker 34:89f53ffc81bb 232 i=i-8;
AhmedPlaymaker 34:89f53ffc81bb 233 }
AhmedPlaymaker 59:c65a2e933c47 234 if(((d==S)||(pad.check_event(Gamepad::R_PRESSED) == true))&&(i<40)) {
AhmedPlaymaker 34:89f53ffc81bb 235 i=i+8;
AhmedPlaymaker 34:89f53ffc81bb 236 }
AhmedPlaymaker 34:89f53ffc81bb 237 lcd.drawSprite(50,i,7,9,(int *)arrow); //Function used to draw the sprite.
AhmedPlaymaker 34:89f53ffc81bb 238 lcd.refresh();
AhmedPlaymaker 34:89f53ffc81bb 239 wait(1/cs);
AhmedPlaymaker 34:89f53ffc81bb 240 lcd.clear();
AhmedPlaymaker 34:89f53ffc81bb 241 }
AhmedPlaymaker 34:89f53ffc81bb 242
AhmedPlaymaker 56:142e9fdb77a8 243 void StartScreen::NextMenu(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 55:df0825049171 244 {
AhmedPlaymaker 55:df0825049171 245 switch (i) {
AhmedPlaymaker 55:df0825049171 246 case 16:
AhmedPlaymaker 49:441c32f6603e 247 game_mode(lcd, pad);
AhmedPlaymaker 55:df0825049171 248 break;
AhmedPlaymaker 55:df0825049171 249 case 24:
AhmedPlaymaker 30:461231877c89 250 float *cs_sc;
AhmedPlaymaker 60:d3a9e0e4a0de 251 cs_sc = _settings.Implement(lcd, pad, cs);
AhmedPlaymaker 56:142e9fdb77a8 252 cs = cs_sc[0]; //saves the number in cs which controls the control speed of the menu oftions (basically the wait time of between reading joystick input).
AhmedPlaymaker 56:142e9fdb77a8 253 sc = cs_sc[1]; //saves the number in sc which decides weather or not to show credits when game starts.
AhmedPlaymaker 56:142e9fdb77a8 254 main_menu(lcd, pad); //to return to main_menu if back is pressed
AhmedPlaymaker 55:df0825049171 255 break;
AhmedPlaymaker 55:df0825049171 256 case 32:
AhmedPlaymaker 49:441c32f6603e 257 _stats.StatsDisplay(lcd, pad);
AhmedPlaymaker 56:142e9fdb77a8 258 main_menu(lcd, pad); //to return to main_menu if back is pressed
AhmedPlaymaker 55:df0825049171 259 break;
AhmedPlaymaker 60:d3a9e0e4a0de 260 case 40:
AhmedPlaymaker 60:d3a9e0e4a0de 261 _tutorial.Implement(lcd, pad);
AhmedPlaymaker 56:142e9fdb77a8 262 main_menu(lcd, pad); //to return to main_menu if back is pressed
AhmedPlaymaker 55:df0825049171 263 break;
AhmedPlaymaker 56:142e9fdb77a8 264 }
AhmedPlaymaker 3:fbb1fa853f09 265 }
AhmedPlaymaker 30:461231877c89 266
AhmedPlaymaker 49:441c32f6603e 267 void StartScreen::game_mode(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 4:1fe015b66bb8 268 {
AhmedPlaymaker 4:1fe015b66bb8 269 lcd.clear();
AhmedPlaymaker 16:7b474f873683 270 wait(2/cs);
AhmedPlaymaker 30:461231877c89 271 pad.init();
AhmedPlaymaker 29:c6358c39a70e 272 while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed.
AhmedPlaymaker 56:142e9fdb77a8 273 StartScreen::ModeOptions(lcd); //displays to the user what are the mode options
AhmedPlaymaker 56:142e9fdb77a8 274 StartScreen::SelectMode(pad); //the mode is selected by moving joystick in this function.
AhmedPlaymaker 34:89f53ffc81bb 275 if (pad.check_event(Gamepad::BACK_PRESSED) == true) { //This is a very important process, this helps the code to not get stuck in menu loop.
AhmedPlaymaker 34:89f53ffc81bb 276 pad.tone(1000.0,0.1);
AhmedPlaymaker 34:89f53ffc81bb 277 back_pressed = 1;
AhmedPlaymaker 34:89f53ffc81bb 278 break;
AhmedPlaymaker 4:1fe015b66bb8 279 }
AhmedPlaymaker 58:affb42c56cf8 280 else {back_pressed = 0;}
AhmedPlaymaker 34:89f53ffc81bb 281 }
AhmedPlaymaker 58:affb42c56cf8 282 pad.tone(1000.0,0.1);
AhmedPlaymaker 34:89f53ffc81bb 283 if(back_pressed) {
AhmedPlaymaker 49:441c32f6603e 284 main_menu(lcd, pad);
AhmedPlaymaker 34:89f53ffc81bb 285 }
AhmedPlaymaker 34:89f53ffc81bb 286 else {
AhmedPlaymaker 59:c65a2e933c47 287 if (g_mode == 2) { StartScreen::motionControlInstructions(lcd); }
AhmedPlaymaker 59:c65a2e933c47 288 else { pad.tone(1000.0,0.1); }
AhmedPlaymaker 29:c6358c39a70e 289 lcd.clear();
AhmedPlaymaker 49:441c32f6603e 290 game_speed(lcd, pad);
AhmedPlaymaker 34:89f53ffc81bb 291 }
AhmedPlaymaker 34:89f53ffc81bb 292 }
AhmedPlaymaker 34:89f53ffc81bb 293
AhmedPlaymaker 56:142e9fdb77a8 294 void StartScreen::ModeOptions(N5110 &lcd)
AhmedPlaymaker 42:973bb6036f81 295 {
AhmedPlaymaker 34:89f53ffc81bb 296 lcd.clear();
AhmedPlaymaker 56:142e9fdb77a8 297 switch (g_mode) {
AhmedPlaymaker 55:df0825049171 298 case 1:
AhmedPlaymaker 34:89f53ffc81bb 299 lcd.printString("Joystick",18,1);
AhmedPlaymaker 57:845781aea5ec 300 lcd.drawSprite(17,22,13,48,(int *)joystick); //Function used to draw the sprite.
AhmedPlaymaker 26:3495f7b0ede7 301 lcd.refresh();
AhmedPlaymaker 55:df0825049171 302 break;
AhmedPlaymaker 55:df0825049171 303 case 2:
AhmedPlaymaker 56:142e9fdb77a8 304 lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
AhmedPlaymaker 56:142e9fdb77a8 305 lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
AhmedPlaymaker 34:89f53ffc81bb 306 lcd.printString("Motion Control",1,1);
AhmedPlaymaker 56:142e9fdb77a8 307 lcd.drawSprite(32,22,12,21,(int *)motionControl); //Function used to draw the sprite.
AhmedPlaymaker 55:df0825049171 308 break;
AhmedPlaymaker 34:89f53ffc81bb 309 }
AhmedPlaymaker 55:df0825049171 310
AhmedPlaymaker 34:89f53ffc81bb 311 lcd.refresh();
AhmedPlaymaker 4:1fe015b66bb8 312 }
AhmedPlaymaker 34:89f53ffc81bb 313
AhmedPlaymaker 56:142e9fdb77a8 314 void StartScreen::SelectMode(Gamepad &pad)
AhmedPlaymaker 56:142e9fdb77a8 315 {
AhmedPlaymaker 56:142e9fdb77a8 316 Direction d = pad.get_direction();
AhmedPlaymaker 56:142e9fdb77a8 317 wait(1/cs);
AhmedPlaymaker 59:c65a2e933c47 318 if(((d==E)||(d==W)||(pad.check_event(Gamepad::R_PRESSED) == true)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(g_mode==1)) {
AhmedPlaymaker 56:142e9fdb77a8 319 g_mode=2;
AhmedPlaymaker 56:142e9fdb77a8 320 }
AhmedPlaymaker 56:142e9fdb77a8 321
AhmedPlaymaker 59:c65a2e933c47 322 else if(((d==E)||(d==W)||(pad.check_event(Gamepad::R_PRESSED) == true)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(g_mode==2)) {
AhmedPlaymaker 56:142e9fdb77a8 323 g_mode=1;
AhmedPlaymaker 56:142e9fdb77a8 324 }
AhmedPlaymaker 56:142e9fdb77a8 325 }
AhmedPlaymaker 56:142e9fdb77a8 326
AhmedPlaymaker 58:affb42c56cf8 327 void StartScreen::motionControlInstructions(N5110 &lcd)
AhmedPlaymaker 58:affb42c56cf8 328 {
AhmedPlaymaker 58:affb42c56cf8 329 lcd.clear();
AhmedPlaymaker 58:affb42c56cf8 330 lcd.printString("While playing the",5,0); //Function used to promt the user to start.
AhmedPlaymaker 58:affb42c56cf8 331 lcd.printString("game, press",9,1);
AhmedPlaymaker 58:affb42c56cf8 332 lcd.printString("A to centre",8,2);
AhmedPlaymaker 58:affb42c56cf8 333 lcd.printString("the snake at",9,3);
AhmedPlaymaker 58:affb42c56cf8 334 lcd.printString("prefered angle",0,4);
AhmedPlaymaker 58:affb42c56cf8 335 lcd.refresh();
AhmedPlaymaker 58:affb42c56cf8 336 wait(2);
AhmedPlaymaker 58:affb42c56cf8 337 }
AhmedPlaymaker 58:affb42c56cf8 338
AhmedPlaymaker 49:441c32f6603e 339 void StartScreen::game_speed(N5110 &lcd, Gamepad &pad)
AhmedPlaymaker 4:1fe015b66bb8 340 {
AhmedPlaymaker 4:1fe015b66bb8 341 lcd.clear();
AhmedPlaymaker 29:c6358c39a70e 342 wait(2/cs);
AhmedPlaymaker 30:461231877c89 343 pad.init();
AhmedPlaymaker 29:c6358c39a70e 344 while ((pad.check_event(Gamepad::A_PRESSED) == false)&&(pad.check_event(Gamepad::START_PRESSED) == false)) { //Change this to if button pressed.
AhmedPlaymaker 58:affb42c56cf8 345 StartScreen::selectSpeedPage(pad);
AhmedPlaymaker 58:affb42c56cf8 346 StartScreen::showSpeedOptions(lcd);
AhmedPlaymaker 35:ce47cde57bd3 347 if (pad.check_event(Gamepad::BACK_PRESSED) == true) { //This is a very important process, this helps the code to not get stuck in menu loop.
AhmedPlaymaker 35:ce47cde57bd3 348 pad.tone(1000.0,0.1);
AhmedPlaymaker 35:ce47cde57bd3 349 back_pressed = 1;
AhmedPlaymaker 35:ce47cde57bd3 350 break;
AhmedPlaymaker 4:1fe015b66bb8 351 }
AhmedPlaymaker 35:ce47cde57bd3 352 else {back_pressed = 0;}
AhmedPlaymaker 35:ce47cde57bd3 353 }
AhmedPlaymaker 35:ce47cde57bd3 354 if(back_pressed) {
AhmedPlaymaker 49:441c32f6603e 355 game_mode(lcd, pad);
AhmedPlaymaker 35:ce47cde57bd3 356 }
AhmedPlaymaker 35:ce47cde57bd3 357 else {
AhmedPlaymaker 35:ce47cde57bd3 358 pad.tone(1000.0,0.1);
AhmedPlaymaker 35:ce47cde57bd3 359 lcd.clear();
AhmedPlaymaker 35:ce47cde57bd3 360 wait(1/cs);
AhmedPlaymaker 4:1fe015b66bb8 361 }
AhmedPlaymaker 35:ce47cde57bd3 362 }
AhmedPlaymaker 35:ce47cde57bd3 363
AhmedPlaymaker 58:affb42c56cf8 364 void StartScreen::selectSpeedPage(Gamepad &pad)
AhmedPlaymaker 35:ce47cde57bd3 365 {
AhmedPlaymaker 35:ce47cde57bd3 366 Direction d = pad.get_direction();
AhmedPlaymaker 5:e4df87957a5b 367 wait(1/cs);
AhmedPlaymaker 59:c65a2e933c47 368 if(((d==E)||(pad.check_event(Gamepad::R_PRESSED) == true))&&(gs==4)) {
AhmedPlaymaker 35:ce47cde57bd3 369 gs=1;
AhmedPlaymaker 35:ce47cde57bd3 370 }
AhmedPlaymaker 59:c65a2e933c47 371 else if(((d==W)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(gs==1)) {
AhmedPlaymaker 35:ce47cde57bd3 372 gs=4;
AhmedPlaymaker 35:ce47cde57bd3 373 }
AhmedPlaymaker 59:c65a2e933c47 374 else if(((d==E)||(pad.check_event(Gamepad::R_PRESSED) == true))&&(1<=gs<=3)) {
AhmedPlaymaker 35:ce47cde57bd3 375 gs=gs+1;
AhmedPlaymaker 35:ce47cde57bd3 376 }
AhmedPlaymaker 59:c65a2e933c47 377 else if(((d==W)||(pad.check_event(Gamepad::L_PRESSED) == true))&&(2<=gs<=4)) {
AhmedPlaymaker 35:ce47cde57bd3 378 gs=gs-1;
AhmedPlaymaker 35:ce47cde57bd3 379 }
AhmedPlaymaker 35:ce47cde57bd3 380 }
AhmedPlaymaker 35:ce47cde57bd3 381
AhmedPlaymaker 58:affb42c56cf8 382 void StartScreen::showSpeedOptions(N5110 &lcd)
AhmedPlaymaker 35:ce47cde57bd3 383 {
AhmedPlaymaker 35:ce47cde57bd3 384 lcd.clear();
AhmedPlaymaker 35:ce47cde57bd3 385 lcd.drawSprite(10,22,13,8,(int *)navL); //Function used to draw the sprite.
AhmedPlaymaker 35:ce47cde57bd3 386 lcd.drawSprite(65,22,13,8,(int *)navR); //Function used to draw the sprite.
AhmedPlaymaker 35:ce47cde57bd3 387 lcd.printString("Game Speed",10,1);
AhmedPlaymaker 55:df0825049171 388 switch (gs) {
AhmedPlaymaker 55:df0825049171 389 case 1:
AhmedPlaymaker 59:c65a2e933c47 390 lcd.printString("SNAKE",28,3);
AhmedPlaymaker 35:ce47cde57bd3 391 fps = 12;
AhmedPlaymaker 55:df0825049171 392 break;
AhmedPlaymaker 55:df0825049171 393 case 2:
AhmedPlaymaker 56:142e9fdb77a8 394 lcd.printString("HUMAN",28,3);
AhmedPlaymaker 35:ce47cde57bd3 395 fps = 18;
AhmedPlaymaker 55:df0825049171 396 break;
AhmedPlaymaker 55:df0825049171 397 case 3:
AhmedPlaymaker 56:142e9fdb77a8 398 lcd.printString("HORSE",28,3);
AhmedPlaymaker 35:ce47cde57bd3 399 fps = 22;
AhmedPlaymaker 55:df0825049171 400 break;
AhmedPlaymaker 55:df0825049171 401 case 4:
AhmedPlaymaker 35:ce47cde57bd3 402 lcd.printString("CHEETHA",21,3);
AhmedPlaymaker 35:ce47cde57bd3 403 fps = 27;
AhmedPlaymaker 35:ce47cde57bd3 404 }
AhmedPlaymaker 55:df0825049171 405
AhmedPlaymaker 21:e41126528cc6 406 lcd.refresh();
AhmedPlaymaker 4:1fe015b66bb8 407 }