Components and supplies
Through Hole Resistor, 1 kohm
Atari Joystick
Speaker, Piezo
Arduino Nano R3
Through Hole Resistor, 100 kohm
Through Hole Resistor, 470 ohm
Pushbutton Switch, Momentary
Project description
Code
TVpacman.ino
arduino
1/************************************************************************** 2 * 3 * ARDUINO PAC-MAN 1.2 4 * 5 * Jan/2022 Giovanni Verrua 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <https://www.gnu.org/licenses/>. 19 * 20 * NOTE: The code isn't optimized. I know that, it could be wrote 21 * in less lines and some choices I made are quite awful. 22 * The main reason is that I wrote it learning Arduino, so I 23 * preferred a code easy to read than a more compact code. 24 * 25 * Also, I faced many strange problems. In example, a simple 26 * variable declaration, an IF sentence, etc. in some cases prevented 27 * the Arduino Nano from boot. Specifically, I couldn't use the 28 * TV.print() function (that's the reason to use bitmap for the score 29 * and the lives) and I also have had serious troubles where the 30 * ghosts slow the speed when they are "haunted" (I mean: when you eat 31 * the magic pill, also called "happy hour" in the comments ;-) or to 32 * make them flashing at the 3 last seconds of the happy hour. 33 * 34 * So, forgive the sometimes strange code, but I've lost more time 35 * trying to fix this kind of problems than to wrote the whole code. 36 * 37 * -- I wrote the game from scratch instead to port it from another 38 * platform. Since I'm not a game designer and honestly I have 39 * no skill about that, I'm sure there's a better way to 40 * write the ghosts AI. My ghosts are AI: Artificially Idiots. 41 * Sorry for that. 42 * 43 * Connections to Arduino Uno/Nano: 44 * 45 * Connect buttons to: pin 2 and +5V (button up), 46 * pin 3 and +5V (button down), 47 * pin 4 and +5V (button left), 48 * pin 5 and +5V (but.right), 49 * pin 6 and +5V (button Fire / Start) 50 * 51 * (note: you can use an Atari compatible Joystick too) 52 * 53 * Connect 100 kohm pulldown resistors between pin 2 and GND, 54 * pin 3 and GND, 55 * pin 4 and GND, 56 * pin 5 and GND, 57 * pin 6 and GND 58 * 59 * TV composite out: 60 * Connect 1k ohm resistor from pin 9 to TV out (+) 61 * Connect 470 ohm resistor from pin 7 to TV out (+) 62 * Connect GND to TV out (-) 63 * 64 * Audio: 65 * Connect a speaker between pin 11 and GND 66 * 67 **************************************************************************/ 68 69#include <TVout.h> 70#include <fontALL.h> 71#include "bitmap.h" 72#include "pitches.h" 73 74 75//You can use buttons or a Joystick Atari compatible 76#define BUTTON_UP 2 77#define BUTTON_DOWN 3 78#define BUTTON_LEFT 4 79#define BUTTON_RIGHT 5 80#define BUTTON_START 6 //digital - button 81 82#define PAC_STARTX 48 //pacman X position 83#define PAC_STARTY 61 //pacman Y position 84 85 86#define GAME_SPEED 30 //higher value, lower speed 87#define GHOST_RELEASE_DELAY 1000 //how many millisec between 2 ghosts release 88 89#define HOWMANYGHOSTS 4 //USED FOR DEBUG. MAX 4 GHOSTS (UNLESS YOU CHANGE THE GHOSTS ARRAY DECLARATIONS AND RESET) 90#define EATGHOSTSECS 10 //TIME ALLOWED TO EAT GHOSTS (HAPPY HOUR) 91 92 93TVout TV; 94 95int Score = 0; 96int lives = 3; 97 98int gamSt = 0; //0 = menu, 1 = in game, 2 = game over 99 100int FoodPosY[8] = {5,15,25,35,55,65,75,85}; 101 102int FoodPosX[12] = { 5, 15, 25, 34, 44, 59, 70, 84, 94,103,113,122}; 103 104//This declaration is just for explaining how the food and pills are. 105//if you need to modify something, must change in reset_food() too. 106int FoodMatr[8][12] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //5 107 { 2, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 2}, //15 108 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //25 109 { 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1}, //35 110 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //55 111 { 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1}, //65 112 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //75 113 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; //85 114 115 116 int gstPosX [4] = {51,52,53,54}; //ghosts position 117 int gstPosY [4] = {41,41,41,41}; //ghosts position 118 int gstDire [4] = {1,1,1,1}; //ghosts direction 0=north, 1=east, 2=south, 3=west 119 120 121//===================================================================================== JINGLE 122void Jingle(){ //Playing pac-man jingle 123 124TV.tone(NOTE_B4 ,100); delay(120); 125TV.tone(NOTE_B5 ,100); delay(120); 126TV.tone(NOTE_FS5,100); delay(120); 127TV.tone(NOTE_DS5,100); delay(120); 128TV.tone(NOTE_FS5,120); delay(200); 129TV.tone(NOTE_DS5,150); delay(250); 130 131TV.tone(NOTE_C5 ,100); delay(120); 132TV.tone(NOTE_C6 ,100); delay(120); 133TV.tone(NOTE_G5 ,100); delay(120); 134TV.tone(NOTE_E5 ,100); delay(120); 135TV.tone(NOTE_C6 ,120); delay(200); 136TV.tone(NOTE_G5 ,150); delay(250); 137 138TV.tone(NOTE_B4 ,100); delay(120); 139TV.tone(NOTE_B5 ,100); delay(120); 140TV.tone(NOTE_FS5,100); delay(120); 141TV.tone(NOTE_DS5,100); delay(120); 142TV.tone(NOTE_B5 ,120); delay(200); 143TV.tone(NOTE_FS5,150); delay(250); 144 145TV.tone(NOTE_DS5,100); delay(120); 146TV.tone(NOTE_DS5,100); delay(120); 147TV.tone(NOTE_E5 ,100); delay(120); 148TV.tone(NOTE_F5 ,100); delay(120); 149TV.tone(NOTE_F5 ,100); delay(120); 150TV.tone(NOTE_FS5,100); delay(120); 151TV.tone(NOTE_G5 ,100); delay(120); 152TV.tone(NOTE_G5 ,100); delay(120); 153TV.tone(NOTE_GS5,100); delay(120); 154TV.tone(NOTE_A5 ,100); delay(120); 155TV.tone(NOTE_B5 ,100); delay(120); 156} 157 158 159 160//===================================================================================== RESET_GHOST 161void reset_ghosts() { 162 163 gstPosX[0] = 51; gstPosX[1] = 52; gstPosX[2] = 53; gstPosX[3] = 54; //ghosts position 164 gstPosY[0] = 41; gstPosY[1] = 41; gstPosY[2] = 41; gstPosY[3] = 41; //ghosts position 165 gstDire[0] = 1; gstDire[1] = 1; gstDire[2] = 1; gstDire[3] = 1; //ghosts direction 0=north, 1=east, 2=south, 3=west 166 167} 168 169//===================================================================================== DRAW_FOOD 170void draw_food() { 171 for (int i=0;i<12;i++){ 172 for (int j=0;j<8;j++){ 173 174 if (FoodMatr[j][i] == 1) { //food 175 TV.set_pixel(FoodPosX[i],FoodPosY[j],1); 176 } 177 178 if (FoodMatr[j][i] == 2) { //pill 179 TV.set_pixel(FoodPosX[i]-1,FoodPosY[j]+1,1); 180 TV.set_pixel(FoodPosX[i]-1,FoodPosY[j]-1,1); 181 TV.set_pixel(FoodPosX[i]+1,FoodPosY[j]-1,1); 182 TV.set_pixel(FoodPosX[i]+1,FoodPosY[j]+1,1); 183 } 184 185 } 186 } 187} 188 189//===================================================================================== RESET_FOOD 190void reset_food() { 191 192 //I tried with a const array for initialization, but i got strange behaviors. I'm sure it's my fault. This isn't elegant but at least it works LOL 193 FoodMatr[0][0]=1; FoodMatr[0][1]=1; FoodMatr[0][2]=1; FoodMatr[0][3]=1; FoodMatr[0][4]=1; FoodMatr[0][5]=1; FoodMatr[0][6]=1; FoodMatr[0][7]=1; FoodMatr[0][8]=1; FoodMatr[0][9]=1; FoodMatr[0][10]=1; FoodMatr[0][11]=1 ; 194 FoodMatr[1][0]=2; FoodMatr[1][1]=0; FoodMatr[1][2]=1; FoodMatr[1][3]=0; FoodMatr[1][4]=1; FoodMatr[1][5]=1; FoodMatr[1][6]=1; FoodMatr[1][7]=1; FoodMatr[1][8]=0; FoodMatr[1][9]=1; FoodMatr[1][10]=0; FoodMatr[1][11]=2 ; 195 FoodMatr[2][0]=1; FoodMatr[2][1]=1; FoodMatr[2][2]=1; FoodMatr[2][3]=1; FoodMatr[2][4]=1; FoodMatr[2][5]=1; FoodMatr[2][6]=1; FoodMatr[2][7]=1; FoodMatr[2][8]=1; FoodMatr[2][9]=1; FoodMatr[2][10]=1; FoodMatr[2][11]=1 ; 196 FoodMatr[3][0]=1; FoodMatr[3][1]=1; FoodMatr[3][2]=1; FoodMatr[3][3]=1; FoodMatr[3][4]=0; FoodMatr[3][5]=0; FoodMatr[3][6]=0; FoodMatr[3][7]=0; FoodMatr[3][8]=1; FoodMatr[3][9]=1; FoodMatr[3][10]=1; FoodMatr[3][11]=1 ; 197 FoodMatr[4][0]=1; FoodMatr[4][1]=1; FoodMatr[4][2]=1; FoodMatr[4][3]=1; FoodMatr[4][4]=1; FoodMatr[4][5]=1; FoodMatr[4][6]=1; FoodMatr[4][7]=1; FoodMatr[4][8]=1; FoodMatr[4][9]=1; FoodMatr[4][10]=1; FoodMatr[4][11]=1 ; 198 FoodMatr[5][0]=1; FoodMatr[5][1]=2; FoodMatr[5][2]=1; FoodMatr[5][3]=1; FoodMatr[5][4]=1; FoodMatr[5][5]=1; FoodMatr[5][6]=1; FoodMatr[5][7]=1; FoodMatr[5][8]=1; FoodMatr[5][9]=1; FoodMatr[5][10]=2; FoodMatr[5][11]=1 ; 199 FoodMatr[6][0]=1; FoodMatr[6][1]=1; FoodMatr[6][2]=1; FoodMatr[6][3]=1; FoodMatr[6][4]=1; FoodMatr[6][5]=1; FoodMatr[6][6]=1; FoodMatr[6][7]=1; FoodMatr[6][8]=1; FoodMatr[6][9]=1; FoodMatr[6][10]=1; FoodMatr[6][11]=1 ; 200 FoodMatr[7][0]=1; FoodMatr[7][1]=1; FoodMatr[7][2]=1; FoodMatr[7][3]=1; FoodMatr[7][4]=1; FoodMatr[7][5]=1; FoodMatr[7][6]=1; FoodMatr[7][7]=1; FoodMatr[7][8]=1; FoodMatr[7][9]=1; FoodMatr[7][10]=1; FoodMatr[7][11]=1 ; 201 202} 203 204//===================================================================================== SETUP 205void setup() { 206 207 TV.begin(_PAL); //128x96 default 208 209 pinMode(BUTTON_UP,INPUT); 210 pinMode(BUTTON_DOWN,INPUT); 211 pinMode(BUTTON_LEFT,INPUT); 212 pinMode(BUTTON_RIGHT,INPUT); 213 pinMode(BUTTON_START,INPUT); 214 215 gamSt = 0; 216} 217 218//===================================================================================== DRAW_SCORE 219//for some reason I can't use the tv.print() function: it hangs the sketch 220//(it compiles fine but after upload it doesn't start). So I must to write the 221//score using bitmaps. 222 223void draw_score() { 224 225 int pos = 30; 226 int num = 0; 227 int zero = 0; 228 229 int a = Score /10; 230 int b = Score /100; 231 int c = Score /1000; 232 int d = Score /10000; 233 234 num = d; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 235 num = c-d*10; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 236 num = b-c*10; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 237 num = a-b*10; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 238 num = Score-a*10; draw_numbers(num,pos); 239 240} 241 242//===================================================================================== DRAW_NUMBERS 243//for some reason I can't use the tv.print() function: it hangs the sketch 244//(it compiles fine but after upload it doesn't start). So I must to write the 245//score using bitmaps. 246void draw_numbers(uint8_t num, uint8_t pos ) { 247 248 if (num == 0) TV.bitmap( pos,88,nu0); 249 if (num == 1) TV.bitmap( pos,88,nu1); 250 if (num == 2) TV.bitmap( pos,88,nu2); 251 if (num == 3) TV.bitmap( pos,88,nu3); 252 if (num == 4) TV.bitmap( pos,88,nu4); 253 if (num == 5) TV.bitmap( pos,88,nu5); 254 if (num == 6) TV.bitmap( pos,88,nu6); 255 if (num == 7) TV.bitmap( pos,88,nu7); 256 if (num == 8) TV.bitmap( pos,88,nu8); 257 if (num == 9) TV.bitmap( pos,88,nu9); 258 259} 260 261 262//===================================================================================== COLLISION 263unsigned char collision(uint8_t x, uint8_t y, uint8_t dir) { 264 265 //-----------------------------------------------------------------------------------------------------north 266 if (dir == 0){ 267 if ( TV.get_pixel(x,y-1)==1 || TV.get_pixel(x+7,y-1)==1 ) return 1; 268 for (int i=1;i<6;i++){ 269 if ( TV.get_pixel(x+i,y-1)==1 && TV.get_pixel(x+i+1,y-1)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 270 } 271 } 272 273 //-----------------------------------------------------------------------------------------------------east 274 if (dir == 1){ 275 if ( TV.get_pixel(x+8,y)==1 || TV.get_pixel(x+8,y+7)==1 ) return 1; 276 for (int i=1;i<6;i++){ 277 if ( TV.get_pixel(x+8,y+i)==1 && TV.get_pixel(x+8,y+i+1)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 278 } 279 } 280 281 //-----------------------------------------------------------------------------------------------------south 282 if (dir == 2){ 283 if ( TV.get_pixel(x,y+8)==1 || TV.get_pixel(x+7,y+8)==1 ) return 1; 284 for (int i=1;i<6;i++){ 285 if ( TV.get_pixel(x+i,y+8)==1 && TV.get_pixel(x+i+1,y+8)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 286 } 287 } 288 289 //-----------------------------------------------------------------------------------------------------west 290 if (dir == 3){ 291 if ( TV.get_pixel(x-1,y)==1 || TV.get_pixel(x-1,y+7)==1 ) return 1; 292 for (int i=1;i<6;i++){ 293 if ( TV.get_pixel(x-1,y+i)==1 && TV.get_pixel(x-1,y+i+1)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 294 } 295 } 296 297 return 0; 298} 299 300//===================================================================================== LOOP 301void loop() { 302 303 bool every_2 = false; 304 //-----------------------------------------------------------------------------------------------------MENU 305 if (gamSt == 0){ //MENU 306 307 TV.clear_screen(); 308 TV.bitmap(0, 0, logo); 309 TV.bitmap(0, 33, start); 310 311 delay(1000); 312 313 while ( digitalRead(BUTTON_START) == 0){} 314 gamSt = 1; 315 delay(300); 316 317 } 318 319 320 //-----------------------------------------------------------------------------------------------------IN GAME 321 322 if (gamSt == 1){ // IN GAME 323 324 Score = 0; 325 lives = 3; 326 327 //--------------------------------- 328 //drawing once the grid and the food before the jingle() - not needed, just for show 329 TV.clear_screen(); 330 TV.bitmap(00,00,grid); 331 reset_food(); 332 draw_food(); 333 Jingle(); 334 //--------------------------------- 335 336 337 while (lives > 0){ 338 339 int eatGhosts = 0; 340 int oldDire = 1; //old pacman direction 341 342 unsigned long mill = millis() ; //delay - aliens 343 unsigned long relg = millis() ; //delay - release ghosts 344 unsigned long eatg = millis() ; //delay - eat ghosts 345 346 347 int pacPosX = PAC_STARTX; //pacman X position 348 int pacPosY = PAC_STARTY; //pacman Y position 349 int pacDire = 1; //pacman direction 0=north, 1=east, 2=south, 3=west > changing with wheel or buttons 350 351 int ghChg[4] = {0,0,0,0}; //ghost change direction 352 int ghSts[4] = {0,0,0,0}; //ghost status (1=eaten, 0=alive) - when eatGhosts = 1 353 354 355 int endfood = 0; // 0 = all eaten, 1 = some food/pills left yet 356 int gotcha = 0; 357 int numofgh = 0; 358 359 endfood = 1; 360 361 TV.clear_screen(); 362 TV.bitmap(00,00,grid); 363 364 reset_ghosts(); 365 reset_food(); 366 draw_food(); 367 368 //-----------------------------------------------------------------------------------------------------Main Cycle-begin-\\ 369 370 while ( endfood != 0 && lives > 0 ) { 371 372 if (mill + GAME_SPEED < millis()){ //the game move all at the same speed 373 374 if (every_2 ) every_2 = false; else every_2 = true; 375 376 if ( numofgh < HOWMANYGHOSTS && relg + GHOST_RELEASE_DELAY < millis() ) { numofgh++; relg = millis(); } 377 378 379 //----------------------------------------------------------------------------------------------\ 380 //DON'T MOVE THIS PART FROM HERE! IT MUST TO DELETE ALL THE GHOSTS BEFORE TO CHECK THE OBSTACLES 381 //OR THE GHOSTS WILL BE CONFUSED BY THE PRESENCE OF OTHER GHOSTS!!! 382 for (int i=0;i<numofgh;i++){ 383 TV.bitmap(gstPosX[i],gstPosY[i],blk); //delete all ghosts before to check obstacles. 384 } 385 TV.bitmap(pacPosX,pacPosY,blk); 386 //----------------------------------------------------------------------------------------------/ 387 388 389 //----------------------------------------------------3 secs to the end of happy hour! Ghosts are flashing 390 if (eatGhosts == 1 && eatg + EATGHOSTSECS*1000 -3000 < millis()) { 391 eatGhosts = 2; 392 } 393 394 //----------------------------------------------------end of happy hour! Ghosts are hunting you again! 395 if (eatGhosts > 0 && eatg + EATGHOSTSECS*1000 < millis()) { 396 eatGhosts = 0; 397 ghSts[0] = 0; ghSts[1] = 0; ghSts[2] = 0; ghSts[3] = 0; 398 } 399 400 //----------------------------------------------------------------------------------------------\ 401 402 oldDire = pacDire ; 403 if ( digitalRead(BUTTON_UP ) == 1) pacDire = 0; //north 404 if ( digitalRead(BUTTON_RIGHT) == 1) pacDire = 1; //east 405 if ( digitalRead(BUTTON_DOWN ) == 1) pacDire = 2; //south 406 if ( digitalRead(BUTTON_LEFT ) == 1) pacDire = 3; //west 407 408 if (collision(pacPosX,pacPosY,pacDire) == 1 && pacDire != oldDire ) pacDire = oldDire ; 409 410 if (collision(pacPosX,pacPosY,pacDire) == 0){ 411 412 if (pacDire == 0) pacPosY--; 413 if (pacDire == 1) pacPosX++; 414 if (pacDire == 2) pacPosY++; 415 if (pacDire == 3) pacPosX--; 416 417 if (pacPosX > 120) pacPosX = 0; 418 if (pacPosX < 0) pacPosX = 120; 419 420 //------------------------------------------------------------------------------------------------------check food/pills 421 endfood = 0; 422 for (int i=0;i<12;i++){ 423 for (int j=0;j<8;j++){ 424 if (FoodMatr[j][i] == 1 || FoodMatr[j][i] == 2 ) { 425 endfood = 1; //still some food / pills to eat 426 427 //-------------------------------------------------------------------------------------------------------food 428 if (FoodPosX[i] >= pacPosX && FoodPosX[i] <= pacPosX+7 && FoodPosY[j] >= pacPosY && FoodPosY[j] <= pacPosY+7) { 429 if (FoodMatr[j][i] == 1) { 430 FoodMatr[j][i] = 0; 431 Score ++; 432 TV.tone(NOTE_G1, 50); 433 } 434 if (FoodMatr[j][i] == 2) { 435 FoodMatr[j][i] = 0; 436 Score += 10; 437 eatGhosts = 1; 438 eatg = millis() ; 439 TV.tone(NOTE_B5, 50); 440 } 441 } 442 //-------------------------------------------------------------------------------------------------------pill 443 } 444 } 445 } 446 447 if (endfood == 0) Jingle(); 448 } 449 450 451 //----------------------------------------------------------------------------------------------/ 452 453 //----------------------------------------------------------------------------------------------pac vs ghost collision 454 gotcha = 0; 455 456 for (int i=0;i<numofgh;i++){ 457 458 if (eatGhosts == 0 || ghSts[i] == 0) { 459 460 //ghost coming from north 461 if ( gstPosY[i] <=pacPosY && gstPosY[i]+8 >=pacPosY && ( (gstPosX[i] >=pacPosX && gstPosX[i]+7 <=pacPosX) || (gstPosX[i] <=pacPosX && gstPosX[i]+7 >=pacPosX) ) ) { gotcha = i+1; i == numofgh; } 462 463 //ghost coming from south 464 if ( pacPosY <=gstPosY[i] && pacPosY +8 >=gstPosY[i] && ( (gstPosX[i] >=pacPosX && gstPosX[i]+7 <=pacPosX) || (gstPosX[i] <=pacPosX && gstPosX[i]+7 >=pacPosX) ) ) { gotcha = i+1; i == numofgh; } 465 466 //ghost coming from west 467 if ( gstPosX[i] <=pacPosX && gstPosX[i]+8 >=pacPosX && ( (gstPosY[i] >=pacPosY && gstPosY[i]+7 <=pacPosY) || (gstPosY[i] <=pacPosY && gstPosY[i]+7 >=pacPosY) ) ) { gotcha = i+1; i == numofgh; } 468 469 //ghost coming from south 470 if ( pacPosX <=gstPosX[i] && pacPosX +8 >=gstPosX[i] && ( (gstPosY[i] >=pacPosY && gstPosY[i]+7 <=pacPosY) || (gstPosY[i] <=pacPosY && gstPosY[i]+7 >=pacPosY) ) ) { gotcha = i+1; i == numofgh; } 471 } 472 } 473 474 if (gotcha > 0 ) { 475 476 if (eatGhosts == 0) { 477 //------------------------------------------------------------- the got you! ---------- 478 lives --; 479 480 for (int i=0;i<5;i++){ 481 TV.tone(NOTE_G1*(5-i)*10, 100); 482 TV.bitmap(pacPosX,pacPosY,p1w); delay(50) ; 483 TV.bitmap(pacPosX,pacPosY,p1s); delay(50) ; 484 TV.bitmap(pacPosX,pacPosY,p1e); delay(50) ; 485 TV.bitmap(pacPosX,pacPosY,p1n); delay(50) ; 486 } 487 delay(1000); 488 relg = millis() ; 489 pacPosX = PAC_STARTX; //pacman X position 490 pacPosY = PAC_STARTY; //pacman Y position 491 pacDire = 1; //pacman direction 0=north, 1=east, 2=south, 3=west > changing with wheel or buttons 492 oldDire = 1; //old pacman direction 493 494 ghChg[0] = 0; ghChg[1] = 0; ghChg[2] = 0; ghChg[3] = 0; //ghost change direction 495 gotcha = 0; 496 numofgh = 0; 497 498 if (lives >0) { 499 TV.clear_screen(); 500 TV.bitmap(00,00,grid); 501 draw_food(); 502 reset_ghosts(); 503 } 504 } 505 //------------------------------------------------------------- you got a ghost!------- 506 else { // eatGhosts == 1 507 TV.tone(NOTE_B6, 200); 508 gstPosX[gotcha-1] = 51; 509 gstPosY[gotcha-1] = 41; 510 Score += 20; 511 512 } 513 } 514 515 516 //---------------------------------------------------------------------------ghost moving-begin-\\ 517 518 for (int i=0;i<numofgh;i++){ //DEBUG //<4 ma bisogna capire come fare per differenziare le direzioni dei fantasmi 519 520 ghChg[i] = 0; 521 522 //direction 0=north, 1=east, 2=south, 3=west 523 524 //----------------------------------------------------------------------------------------north 525 if (gstDire[i]==0 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ // 526 if (pacPosX < gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 527 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } else { //n -> w 528 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } } //n -> e 529 } 530 else { 531 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } else { //n -> e 532 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } } //n -> w 533 } 534 if ( ghChg[i]==0 ) {gstDire[i]=2; ghChg[i] = 1; } //n -> s} //means it can only go back 535 } 536 //----------------------------------------------------------------------------------------east 537 if (gstDire[i]==1 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ 538 if (pacPosY > gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 539 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } else { //e -> s 540 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } } //e -> n 541 } 542 else { 543 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } else { //e -> n 544 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } } //e -> s 545 } 546 if ( ghChg[i]==0 ) {gstDire[i]=3; ghChg[i] = 1; } //e -> w} //means it can only go back 547 } 548 //----------------------------------------------------------------------------------------south 549 if (gstDire[i]==2 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ 550 if (pacPosX > gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 551 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } else { //s -> e 552 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } } //s -> w 553 } 554 else { 555 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } else { //s -> w 556 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } } //s -> e 557 } 558 if ( ghChg[i]==0 ) {gstDire[i]=0; ghChg[i] = 1; } //s -> n} //means it can only go back 559 } 560 //----------------------------------------------------------------------------------------west 561 if (gstDire[i]==3 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ 562 if (pacPosY < gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 563 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } else { //w -> n 564 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } } //w -> s 565 } 566 else { 567 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } else { //w -> s 568 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } } //w -> n 569 } 570 if ( ghChg[i]==0 ) {gstDire[i]=1; ghChg[i] = 1; } //w -> e} //means it can only go back 571 } 572 573 574 } //next i 575 576 577 578 for (int i=0;i<numofgh;i++){ 579 580 581 if (ghChg[i]==0 && random(1,3) == 1){ 582 583 //----------------------------------------------------------------------------------------west 584 if (gstDire[i]==3 && ghChg[i]==0){ //west 585 if (pacPosY < gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 586 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //w -> n 587 if (random(1,5)==2){ 588 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //w -> s 589 } 590 } 591 else { 592 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //w -> s 593 if (random(1,5)==2){ 594 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //w -> n 595 } 596 } 597 } 598 599 //----------------------------------------------------------------------------------------north 600 if (gstDire[i]==0 && ghChg[i]==0){ //north 601 if (pacPosX < gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 602 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //n -> e 603 if (random(1,5)==2){ 604 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //n -> w 605 } 606 } 607 608 else { 609 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //n -> w 610 if (random(1,5)==2){ 611 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //n -> e 612 } 613 } 614 } 615 616 //----------------------------------------------------------------------------------------east 617 if (gstDire[i]==1 && ghChg[i]==0){ //east 618 if (pacPosY > gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 619 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //e -> s 620 if (random(1,5)==2){ 621 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //e -> n 622 } 623 } 624 else { 625 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //e -> n 626 if (random(1,5)==2){ 627 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //e -> s 628 } 629 } 630 } 631 632 //----------------------------------------------------------------------------------------south 633 if (gstDire[i]==2 && ghChg[i]==0){ //south 634 if (pacPosX > gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 635 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //s -> w 636 if (random(1,5)==2){ 637 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //s -> e 638 } 639 } 640 else { 641 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //s -> e 642 if (random(1,5)==2){ 643 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //s -> w 644 } 645 } 646 } 647 648 649 } 650 651 652 //--------------------------------------------------------------------------------------don't touch the code or will hang Arduino begin ---\\ 653 //I know that the code isn't optimized and could be written in a more compact way; however if you will touch 654 //this part, even with replicated code, the sketch will hang the Arduino - it drove me crazy and this was 655 //the only way I succeded. If you find a better and working way, or can explain me how it hangs, please 656 //advise me. Thank you! 657 658 //if (eatGhosts == 0 && every_2 ) { this should work fine and avoid to replicate the IF; instead it hangs the sketch. 659 660 if (eatGhosts == 0 ) { //ghosts at normal speed (they're hunting you) 661 if (gstDire[i] == 0) gstPosY[i]--; 662 if (gstDire[i] == 1) gstPosX[i]++; 663 if (gstDire[i] == 2) gstPosY[i]++; 664 if (gstDire[i] == 3) gstPosX[i]--; 665 666 if (gstPosX[i] > 120) gstPosX[i] = 0; 667 if (gstPosX[i] < 0) gstPosX[i] = 120; 668 if (gstPosX[i] > 120) gstPosX[i] = 0; else if (gstPosX[i] < 0) gstPosX[i] = 120; 669 } 670 //------------------------------------------------------------------------------- 671 if ( eatGhosts > 0 && every_2 ) { //happy hour, the ghosts are haunted and move at half speed 672 if (gstDire[i] == 0) gstPosY[i]--; 673 if (gstDire[i] == 1) gstPosX[i]++; 674 if (gstDire[i] == 2) gstPosY[i]++; 675 if (gstDire[i] == 3) gstPosX[i]--; 676 677 if (gstPosX[i] > 120) gstPosX[i] = 0; 678 if (gstPosX[i] < 0) gstPosX[i] = 120; 679 if (gstPosX[i] > 120) gstPosX[i] = 0; else if (gstPosX[i] < 0) gstPosX[i] = 120; 680 } 681 682 //-----------------------------------------------------------------------draw ghosts 683 //Again, don't touch this part or the sketch will hang the Arduino! 684 685 if (eatGhosts == 0) { 686 if ( (gstPosX[i] % 2) - (gstPosY[i] % 2) == 0) TV.bitmap(gstPosX[i],gstPosY[i],g1n); 687 else TV.bitmap(gstPosX[i],gstPosY[i],g2n); 688 } 689 690 if (eatGhosts == 1) { 691 if ( (gstPosX[i] % 2) - (gstPosY[i] % 2) == 0) TV.bitmap(gstPosX[i],gstPosY[i],g1h); 692 else TV.bitmap(gstPosX[i],gstPosY[i],g2h); 693 } 694 695 if (eatGhosts == 2) { 696 if ( (gstPosX[i] % 2) - (gstPosY[i] % 2) == 0) TV.bitmap(gstPosX[i],gstPosY[i],g1h); 697 else TV.bitmap(gstPosX[i],gstPosY[i],g2n); 698 699 } 700 //--------------------------------------------------------------------------------------don't touch the code or will hang Arduino end -----/ 701 702 703 704 705 } //next i 706 //---------------------------------------------------------------------------ghost moving-end---/ 707 708 709 710 //--------------------------------------------------------------------------------------------------- draw Pac Man 711 if (pacDire == 0) { 712 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1n); } 713 else { TV.bitmap(pacPosX,pacPosY,p2n); } 714 } 715 if (pacDire == 1) { 716 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1e); } 717 else { TV.bitmap(pacPosX,pacPosY,p2e); } 718 } 719 if (pacDire == 2) { 720 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1s); } 721 else { TV.bitmap(pacPosX,pacPosY,p2s); } 722 } 723 if (pacDire == 3) { 724 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1w); } 725 else { TV.bitmap(pacPosX,pacPosY,p2w); } 726 } 727 728 //--------------------------------------------------------------------------------------------------- 729 draw_food(); 730 draw_score(); 731 draw_numbers( lives, 118 ); 732 733 //------------------------------------------------------------ 734 mill = millis(); 735 } 736 737 738 //-----------------------------------------------------------------------------------------------------Main Cycle-end--- / 739 740 } //while endfood != 0 741 742 } //while lives >0 743 gamSt = 2 ; 744 } //if gamst == 1 745 746 //-----------------------------------------------------------------------------------------------------GAME OVER 747 if (gamSt == 2){ //GAME OVER 748 gamSt = 0; 749 TV.clear_screen(); 750 TV.bitmap(0, 0, logo); 751 TV.bitmap(0, 33, over); 752 753 draw_score(); 754 delay(1000); 755 756 //must to release and press again the button before to continue 757 while ( digitalRead(BUTTON_START) == 1){} 758 while ( digitalRead(BUTTON_START) == 0){} 759 760 } 761 762} 763
bitmap.h
arduino
1/** 2 * PacMan 3 * 4 */ 5 6 7//ghost 1 normal 8PROGMEM const unsigned char g1n[] = { 98, 8, //pictureresolution 10 0x3C,0x7E,0xFF,0xDB,0x93,0xFF,0xFF,0xA5}; 11 12 13//ghost 2 normal 14PROGMEM const unsigned char g2n[] = { 158, 8, //pictureresolution 16 0x3C,0x7E,0xFF,0x93,0xDB,0xFF,0xFF,0xA5}; 17 18//ghost 1 haunted 19PROGMEM const unsigned char g1h[] = { 208, 8, //pictureresolution 210x3C,0x42,0x81,0xA5,0xED,0x81,0xDB,0xA5}; 22 23//ghost 2 haunted 24PROGMEM const unsigned char g2h[] = { 258, 8, //pictureresolution 260x3C,0x42,0x81,0xED,0xA5,0x81,0xDB,0xA5}; 27 28//pacman 1 east 29PROGMEM const unsigned char p1e[] = { 308, 8, //pictureresolution 31 0x3C,0x7E,0xF7,0xFF,0xF0,0xFF,0x7E,0x3C}; 32 33//pacman 2 east 34PROGMEM const unsigned char p2e[] = { 358, 8, //pictureresolution 36 0x3C,0x7E,0xF7,0xFC,0xF0,0xFF,0x7E,0x3C}; 37 38 39//pacman 1 north 40PROGMEM const unsigned char p1n[] = { 418, 8, //pictureresolution 42 0x2C,0x6E,0xEF,0xEB,0xFF,0xFF,0x7E,0x3C}; 43 44//pacman 2 north 45PROGMEM const unsigned char p2n[] = { 468, 8, //pictureresolution 47 0x24,0x66,0xEF,0xEB,0xFF,0xFF,0x7E,0x3C}; 48 49//pacman 1 west 50PROGMEM const unsigned char p1w[] = { 518, 8, //pictureresolution 520x3C,0x7E,0xEF,0xFF,0x0F,0xFF,0x7E,0x3C}; 53 54//pacman 2 west 55PROGMEM const unsigned char p2w[] = { 568, 8, //pictureresolution 570x3C,0x7E,0xEF,0x3F,0x0F,0xFF,0x7E,0x3C}; 58 59//pacman 1 south 60PROGMEM const unsigned char p1s[] = { 618, 8, //pictureresolution 620x3C,0x7E,0xFF,0xFF,0xEB,0xEF,0x6E,0x2C}; 63 64//pacman 2 south 65PROGMEM const unsigned char p2s[] = { 668, 8, //pictureresolution 670x3C,0x7E,0xFF,0xFF,0xEB,0xEF,0x66,0x24}; 68 69//delete ghost/pac 70PROGMEM const unsigned char blk[] = { 718, 8, //pictureresolution 720x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; 73 74 75//1 76PROGMEM const unsigned char nu1[] = { 778, 8, //pictureresolution 780x00,0xFF,0x00,0x08,0x18,0x08,0x08,0x1C}; 79 80 81//2 82PROGMEM const unsigned char nu2[] = { 838, 8, //pictureresolution 840x00,0xFF,0x00,0x3C,0x04,0x3C,0x20,0x3C}; 85 86 87//3 88PROGMEM const unsigned char nu3[] = { 898, 8, //pictureresolution 900x00,0xFF,0x00,0x3C,0x04,0x3C,0x04,0x3C}; 91 92 93//4 94PROGMEM const unsigned char nu4[] = { 958, 8, //pictureresolution 960x00,0xFF,0x00,0x24,0x24,0x3C,0x04,0x04}; 97 98 99//5 100PROGMEM const unsigned char nu5[] = { 1018, 8, //pictureresolution 1020x00,0xFF,0x00,0x3C,0x20,0x3C,0x04,0x3C}; 103 104 105//6 106PROGMEM const unsigned char nu6[] = { 1078, 8, //pictureresolution 1080x00,0xFF,0x00,0x3C,0x20,0x3C,0x24,0x3C}; 109 110//7 111PROGMEM const unsigned char nu7[] = { 1128, 8, //pictureresolution 1130x00,0xFF,0x00,0x3C,0x04,0x08,0x10,0x10}; 114 115 116//8 117PROGMEM const unsigned char nu8[] = { 1188, 8, //pictureresolution 1190x00,0xFF,0x00,0x3C,0x24,0x3C,0x24,0x3C}; 120 121 122//9 123PROGMEM const unsigned char nu9[] = { 1248, 8, //pictureresolution 1250x00,0xFF,0x00,0x3C,0x24,0x3C,0x04,0x3C}; 126 127//0 128PROGMEM const unsigned char nu0[] = { 1298, 8, //pictureresolution 1300x00,0xFF,0x00,0x3C,0x24,0x24,0x24,0x3C}; 131 132//grid 133PROGMEM const unsigned char grid[] = { 134 128, 96, //pictureresolution 135 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 136 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 137 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 138 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 139 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 140 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 141 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 142 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 143 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 144 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 145 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 146 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 147 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 148 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 149 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 150 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 151 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 152 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 153 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 154 0xC0,0x3F,0xF8,0x07,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0xE0,0x1F,0xFC,0x03, 155 0xC0,0x3F,0xF8,0x07,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0xE0,0x1F,0xFC,0x03, 156 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 157 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 158 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 159 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 160 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 161 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 162 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 163 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 164 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 165 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 166 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 167 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 168 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 169 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 170 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 171 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 172 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 173 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 174 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFC,0x03,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 175 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFC,0x03,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 176 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 177 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 178 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 179 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 180 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 181 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 182 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 183 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 184 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 185 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 186 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 187 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 188 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 189 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 190 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 191 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 192 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 193 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 194 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 195 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 196 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 197 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 198 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 199 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 200 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 201 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 202 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 203 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 204 0xFF,0xE0,0x1F,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xF8,0x07,0xFF, 205 0xFF,0xE0,0x1F,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xF8,0x07,0xFF, 206 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 207 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 208 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 209 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 210 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 211 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 212 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 213 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 214 0xC0,0x3F,0xFF,0xFF,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,0x03, 215 0xC0,0x3F,0xFF,0xFF,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,0x03, 216 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 217 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 218 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 219 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 220 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 221 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 222 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 223 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 224 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 225 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 226 0x3D,0xEF,0x7B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x14,0xBD,0xE8,0x00, 227 0x21,0x09,0x4A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x14,0xA1,0x00,0x00, 228 0x3D,0x09,0x7B,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x14,0xB9,0xE0,0x00, 229 0x05,0x09,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x15,0x20,0x20,0x00, 230 0x3D,0xEF,0x4B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xD2,0x3D,0xE8,0x00 231}; 232 233 234//start 235PROGMEM const unsigned char start[] = { 236 128, 64, //pictureresolution 237 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 238 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 239 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 240 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 241 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 242 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 243 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 244 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 245 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 246 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 247 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 248 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 249 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xE7,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 250 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xE7,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 251 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 252 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 253 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 254 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 255 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 256 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 257 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 258 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 259 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 260 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 261 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 262 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 263 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 264 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 265 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 266 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 267 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 268 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 269 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 270 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 271 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 272 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 273 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 274 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 275 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 276 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 277 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 278 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 279 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 280 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 281 0x00,0x00,0x00,0x00,0xF3,0xCF,0x9C,0x70,0x07,0x3E,0x73,0xCF,0x80,0x00,0x00,0x00, 282 0x00,0x00,0x00,0x00,0x8A,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 283 0x00,0x00,0x00,0x00,0x8A,0x28,0x20,0x80,0x08,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 284 0x00,0x00,0x00,0x00,0xF3,0xCF,0x1C,0x70,0x07,0x08,0x8B,0xC2,0x00,0x00,0x00,0x00, 285 0x00,0x00,0x00,0x00,0x82,0x48,0x02,0x08,0x00,0x88,0xFA,0x42,0x00,0x00,0x00,0x00, 286 0x00,0x00,0x00,0x00,0x82,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 287 0x00,0x00,0x00,0x00,0x82,0x2F,0x9C,0x70,0x07,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 288 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 289 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 290 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 291 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 292 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 293 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 294 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 295 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 296 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 297 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 298 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 299 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 300 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 301}; 302 303 304//game over 305PROGMEM const unsigned char over[] = { 306 128, 64, //pictureresolution 307 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 308 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 309 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 310 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 311 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 312 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 313 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 314 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 315 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 316 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 317 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 318 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 319 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 320 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 321 0x00,0x0F,0xE0,0x00,0x01,0xFF,0x00,0x07,0xFC,0x00,0x1F,0xF0,0x00,0x7F,0xC0,0x00, 322 0x00,0x3F,0xF8,0x00,0x03,0xFF,0x80,0x0F,0xFE,0x00,0x3F,0xF8,0x00,0xFF,0xE0,0x00, 323 0x00,0x7F,0xFC,0x00,0x07,0xFF,0xC0,0x1F,0xFF,0x00,0x7F,0xFC,0x01,0xFF,0xF0,0x00, 324 0x00,0xFE,0x7E,0x00,0x0F,0xFF,0xE0,0x3F,0xFF,0x80,0xFF,0xFE,0x03,0xFF,0xF8,0x00, 325 0x01,0xFE,0x7F,0x00,0x00,0xF8,0x70,0x03,0xE1,0xC0,0x0F,0x87,0x00,0x3E,0x1C,0x00, 326 0x00,0x7F,0xFF,0x00,0x1E,0xF7,0x70,0x7B,0xDD,0xC1,0xEF,0x77,0x07,0xBD,0xDC,0x00, 327 0x00,0x0F,0xFF,0x80,0x1F,0x77,0xB0,0x7D,0xDE,0xC1,0xF7,0x7B,0x07,0xDD,0xEC,0x00, 328 0x00,0x01,0xFF,0x80,0x23,0x71,0xB0,0x8D,0xC6,0xC2,0x37,0x1B,0x08,0xDC,0x6C,0x00, 329 0x00,0x00,0x1F,0x80,0x23,0x71,0xB8,0x8D,0xC6,0xE2,0x37,0x1B,0x88,0xDC,0x6E,0x00, 330 0x00,0x00,0x1F,0x80,0x23,0x71,0xB8,0x8D,0xC6,0xE2,0x37,0x1B,0x88,0xDC,0x6E,0x00, 331 0x00,0x01,0xFF,0x80,0x2E,0xF7,0x78,0xBB,0xDD,0xE2,0xEF,0x77,0x8B,0xBD,0xDE,0x00, 332 0x00,0x0F,0xFF,0x80,0x31,0xF8,0xF8,0xC7,0xE3,0xE3,0x1F,0x8F,0x8C,0x7E,0x3E,0x00, 333 0x00,0x7F,0xFF,0x80,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 334 0x01,0xFF,0xFF,0x00,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 335 0x01,0xFF,0xFE,0x00,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 336 0x00,0x7F,0xFC,0x00,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 337 0x00,0x1F,0xF8,0x00,0x3F,0xE7,0xF8,0xFF,0x9F,0xE3,0xFE,0x7F,0x8F,0xF9,0xFE,0x00, 338 0x00,0x0F,0xE0,0x00,0x39,0xC7,0x98,0xE7,0x1E,0x63,0x9C,0x79,0x8E,0x71,0xE6,0x00, 339 0x00,0x00,0x00,0x00,0x20,0xC7,0x08,0x83,0x1C,0x22,0x0C,0x70,0x88,0x31,0xC2,0x00, 340 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 341 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 342 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 343 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 344 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 345 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 346 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 347 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 348 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 349 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 350 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 351 0x00,0x00,0x00,0x00,0x03,0x8E,0x45,0xF0,0x0E,0x45,0xF7,0x80,0x00,0x00,0x00,0x00, 352 0x00,0x00,0x00,0x00,0x04,0x51,0x6D,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 353 0x00,0x00,0x00,0x00,0x04,0x11,0x55,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 354 0x00,0x00,0x00,0x00,0x05,0xD1,0x45,0xE0,0x11,0x45,0xE7,0x80,0x00,0x00,0x00,0x00, 355 0x00,0x00,0x00,0x00,0x04,0x5F,0x45,0x00,0x11,0x45,0x04,0x80,0x00,0x00,0x00,0x00, 356 0x00,0x00,0x00,0x00,0x04,0x51,0x45,0x00,0x11,0x29,0x04,0x40,0x00,0x00,0x00,0x00, 357 0x00,0x00,0x00,0x00,0x03,0xD1,0x45,0xF0,0x0E,0x11,0xF4,0x40,0x00,0x00,0x00,0x00, 358 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 359 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 360 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 361 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 362 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 363 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 364 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 365 0x3D,0xEF,0x7B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 366 0x21,0x09,0x4A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 367 0x3D,0x09,0x7B,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 368 0x05,0x09,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 369 0x3D,0xEF,0x4B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 370 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 371}; 372 373//logo 374PROGMEM const unsigned char logo[] = { 375 128, 32, //pictureresolution 376 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0, 377 0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, 378 0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C, 379 0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C, 380 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E, 381 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 382 0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07, 383 0xC0,0xFF,0xC0,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x7F,0x03, 384 0xC0,0xFF,0xF0,0x18,0x00,0xFF,0xE0,0x00,0x03,0x00,0x0C,0x03,0x80,0x60,0x7F,0x03, 385 0xC0,0xFF,0xF8,0x3C,0x01,0xFF,0xF0,0x00,0x03,0x80,0x1C,0x03,0x80,0x70,0x7F,0x03, 386 0xC0,0xFF,0xF8,0x3C,0x03,0xFF,0xF8,0x00,0x03,0xC0,0x3C,0x07,0xC0,0x78,0x7F,0x03, 387 0xC0,0xFF,0xFC,0x7E,0x03,0xFF,0xFC,0x00,0x03,0xE0,0x7C,0x07,0xC0,0x7C,0x7F,0x03, 388 0xC0,0xFF,0xFC,0x7E,0x07,0xFF,0xF8,0x00,0x03,0xF0,0xFC,0x0F,0xE0,0x7E,0x7F,0x03, 389 0xC0,0xFE,0xFC,0xFF,0x07,0xFF,0xC0,0x7F,0x03,0xF8,0xFC,0x0F,0xF0,0x7F,0x7F,0x03, 390 0xC0,0xFF,0xFC,0xFF,0x8F,0xFF,0x00,0x7F,0xC3,0xFD,0xFC,0x1F,0xF0,0x7F,0x7F,0x03, 391 0xC0,0xFF,0xFD,0xFF,0x8F,0xFE,0x00,0x7F,0xC3,0xFF,0xFC,0x3F,0xF8,0x7F,0xFF,0x03, 392 0xC0,0xFF,0xF9,0xFF,0xCF,0xFC,0x00,0x3F,0xC3,0xFF,0xFC,0x3F,0xF8,0x7F,0xFF,0x03, 393 0xC0,0xFF,0xFB,0xE7,0xC7,0xFF,0x00,0x3F,0xC3,0xFF,0xFC,0x7E,0x7C,0x7F,0xFF,0x03, 394 0xC0,0xFF,0xF3,0xFF,0xE7,0xFF,0xF0,0x00,0x03,0xFF,0xFC,0x7F,0xFC,0x7F,0xFF,0x03, 395 0xC0,0xFE,0x07,0xFF,0xE7,0xFF,0xFC,0x00,0x03,0xFF,0xFC,0xFF,0xFE,0x7F,0xFF,0x03, 396 0xC0,0xFE,0x07,0xFF,0xE3,0xFF,0xFC,0x00,0x03,0xFF,0xFC,0xFF,0xFE,0x7F,0xFF,0x03, 397 0xC0,0xFE,0x0F,0xFF,0xF1,0xFF,0xFC,0x00,0x03,0xFF,0xFC,0xFF,0xFF,0x7F,0xFF,0x03, 398 0xC0,0xFE,0x0F,0xFF,0xB9,0xFF,0xF8,0x00,0x03,0xFF,0xDD,0xFF,0xF7,0x3F,0xF7,0x03, 399 0xC0,0xFE,0x0F,0xFF,0xB8,0x7F,0xF0,0x00,0x03,0xFF,0xDD,0xFF,0xF7,0xBF,0xF7,0x03, 400 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 401 0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07, 402 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 403 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 404 0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E, 405 0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C, 406 0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8, 407 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0 408}; 409
bitmap.h
arduino
1/** 2 * PacMan 3 * 4 */ 5 6 7//ghost 1 normal 8PROGMEM const 9 unsigned char g1n[] = { 108, 8, //pictureresolution 11 0x3C,0x7E,0xFF,0xDB,0x93,0xFF,0xFF,0xA5}; 12 13 14//ghost 15 2 normal 16PROGMEM const unsigned char g2n[] = { 178, 8, //pictureresolution 18 19 0x3C,0x7E,0xFF,0x93,0xDB,0xFF,0xFF,0xA5}; 20 21//ghost 1 haunted 22PROGMEM 23 const unsigned char g1h[] = { 248, 8, //pictureresolution 250x3C,0x42,0x81,0xA5,0xED,0x81,0xDB,0xA5}; 26 27//ghost 28 2 haunted 29PROGMEM const unsigned char g2h[] = { 308, 8, //pictureresolution 310x3C,0x42,0x81,0xED,0xA5,0x81,0xDB,0xA5}; 32 33//pacman 34 1 east 35PROGMEM const unsigned char p1e[] = { 368, 8, //pictureresolution 37 38 0x3C,0x7E,0xF7,0xFF,0xF0,0xFF,0x7E,0x3C}; 39 40//pacman 2 east 41PROGMEM const 42 unsigned char p2e[] = { 438, 8, //pictureresolution 44 0x3C,0x7E,0xF7,0xFC,0xF0,0xFF,0x7E,0x3C}; 45 46 47//pacman 48 1 north 49PROGMEM const unsigned char p1n[] = { 508, 8, //pictureresolution 51 52 0x2C,0x6E,0xEF,0xEB,0xFF,0xFF,0x7E,0x3C}; 53 54//pacman 2 north 55PROGMEM const 56 unsigned char p2n[] = { 578, 8, //pictureresolution 58 0x24,0x66,0xEF,0xEB,0xFF,0xFF,0x7E,0x3C}; 59 60//pacman 61 1 west 62PROGMEM const unsigned char p1w[] = { 638, 8, //pictureresolution 640x3C,0x7E,0xEF,0xFF,0x0F,0xFF,0x7E,0x3C}; 65 66//pacman 67 2 west 68PROGMEM const unsigned char p2w[] = { 698, 8, //pictureresolution 700x3C,0x7E,0xEF,0x3F,0x0F,0xFF,0x7E,0x3C}; 71 72//pacman 73 1 south 74PROGMEM const unsigned char p1s[] = { 758, 8, //pictureresolution 760x3C,0x7E,0xFF,0xFF,0xEB,0xEF,0x6E,0x2C}; 77 78//pacman 79 2 south 80PROGMEM const unsigned char p2s[] = { 818, 8, //pictureresolution 820x3C,0x7E,0xFF,0xFF,0xEB,0xEF,0x66,0x24}; 83 84//delete 85 ghost/pac 86PROGMEM const unsigned char blk[] = { 878, 8, //pictureresolution 880x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}; 89 90 91//1 92PROGMEM 93 const unsigned char nu1[] = { 948, 8, //pictureresolution 950x00,0xFF,0x00,0x08,0x18,0x08,0x08,0x1C}; 96 97 98//2 99PROGMEM 100 const unsigned char nu2[] = { 1018, 8, //pictureresolution 1020x00,0xFF,0x00,0x3C,0x04,0x3C,0x20,0x3C}; 103 104 105//3 106PROGMEM 107 const unsigned char nu3[] = { 1088, 8, //pictureresolution 1090x00,0xFF,0x00,0x3C,0x04,0x3C,0x04,0x3C}; 110 111 112//4 113PROGMEM 114 const unsigned char nu4[] = { 1158, 8, //pictureresolution 1160x00,0xFF,0x00,0x24,0x24,0x3C,0x04,0x04}; 117 118 119//5 120PROGMEM 121 const unsigned char nu5[] = { 1228, 8, //pictureresolution 1230x00,0xFF,0x00,0x3C,0x20,0x3C,0x04,0x3C}; 124 125 126//6 127PROGMEM 128 const unsigned char nu6[] = { 1298, 8, //pictureresolution 1300x00,0xFF,0x00,0x3C,0x20,0x3C,0x24,0x3C}; 131 132//7 133PROGMEM 134 const unsigned char nu7[] = { 1358, 8, //pictureresolution 1360x00,0xFF,0x00,0x3C,0x04,0x08,0x10,0x10}; 137 138 139//8 140PROGMEM 141 const unsigned char nu8[] = { 1428, 8, //pictureresolution 1430x00,0xFF,0x00,0x3C,0x24,0x3C,0x24,0x3C}; 144 145 146//9 147PROGMEM 148 const unsigned char nu9[] = { 1498, 8, //pictureresolution 1500x00,0xFF,0x00,0x3C,0x24,0x3C,0x04,0x3C}; 151 152//0 153PROGMEM 154 const unsigned char nu0[] = { 1558, 8, //pictureresolution 1560x00,0xFF,0x00,0x3C,0x24,0x24,0x24,0x3C}; 157 158//grid 159PROGMEM 160 const unsigned char grid[] = { 161 128, 96, //pictureresolution 162 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 163 164 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 165 166 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 167 168 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 169 170 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 171 172 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 173 174 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 175 176 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 177 178 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 179 180 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 181 182 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 183 184 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 185 186 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 187 188 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 189 190 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 191 192 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 193 194 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 195 196 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 197 198 0xC0,0x20,0x18,0x04,0x01,0x00,0x00,0x00,0x00,0x00,0x00,0x80,0x20,0x10,0x04,0x03, 199 200 0xC0,0x3F,0xF8,0x07,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0xE0,0x1F,0xFC,0x03, 201 202 0xC0,0x3F,0xF8,0x07,0xFF,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xFF,0xE0,0x1F,0xFC,0x03, 203 204 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 205 206 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 207 208 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 209 210 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 211 212 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 213 214 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 215 216 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 217 218 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 219 220 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 221 222 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 223 224 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 225 226 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 227 228 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 229 230 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 231 232 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 233 234 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 235 236 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 237 238 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x00,0x00,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 239 240 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFC,0x03,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 241 242 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFC,0x03,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 243 244 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 245 246 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 247 248 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 249 250 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 251 252 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 253 254 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 255 256 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 257 258 0x00,0x00,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x03,0x00,0xC0,0x00,0x00,0x00,0x00, 259 260 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 261 262 0xFF,0xFF,0xFF,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xFF,0xFF,0xFF, 263 264 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 265 266 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 267 268 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 269 270 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 271 272 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 273 274 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 275 276 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 277 278 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x01,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 279 280 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 281 282 0xC0,0x3F,0xF8,0x07,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xE0,0x1F,0xFC,0x03, 283 284 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 285 286 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 287 288 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 289 290 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 291 292 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 293 294 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 295 296 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 297 298 0xC0,0x00,0x18,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x18,0x00,0x03, 299 300 0xFF,0xE0,0x1F,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xF8,0x07,0xFF, 301 302 0xFF,0xE0,0x1F,0xFC,0x03,0x00,0xFF,0xFF,0xFF,0xFF,0x00,0xC0,0x3F,0xF8,0x07,0xFF, 303 304 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 305 306 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 307 308 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 309 310 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 311 312 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 313 314 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 315 316 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 317 318 0xC0,0x00,0x00,0x00,0x03,0x00,0x00,0x01,0x80,0x00,0x00,0xC0,0x00,0x00,0x00,0x03, 319 320 0xC0,0x3F,0xFF,0xFF,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,0x03, 321 322 0xC0,0x3F,0xFF,0xFF,0xFF,0xFF,0xFE,0x01,0x80,0x7F,0xFF,0xFF,0xFF,0xFF,0xFC,0x03, 323 324 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 325 326 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 327 328 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 329 330 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 331 332 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 333 334 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 335 336 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 337 338 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 339 340 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 341 342 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 343 344 0x3D,0xEF,0x7B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x14,0xBD,0xE8,0x00, 345 346 0x21,0x09,0x4A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x14,0xA1,0x00,0x00, 347 348 0x3D,0x09,0x7B,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x14,0xB9,0xE0,0x00, 349 350 0x05,0x09,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x02,0x15,0x20,0x20,0x00, 351 352 0x3D,0xEF,0x4B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xD2,0x3D,0xE8,0x00 353}; 354 355 356//start 357 358PROGMEM const unsigned char start[] = { 359 128, 64, //pictureresolution 360 361 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 362 363 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 364 365 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 366 367 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 368 369 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 370 371 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 372 373 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 374 375 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 376 377 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 378 379 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 380 381 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 382 383 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 384 385 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xE7,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 386 387 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xE7,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 388 389 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 390 391 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 392 393 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 394 395 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xE0,0x00,0x00,0x00,0x00,0x00,0x00, 396 397 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x80,0x00,0x00,0x00,0x00,0x00,0x00, 398 399 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 400 401 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 402 403 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 404 405 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 406 407 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 408 409 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 410 411 0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 412 413 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 414 415 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 416 417 0x00,0x00,0x00,0x00,0x00,0x00,0x7F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 418 419 0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0xFF,0xFF,0x00,0x00,0x00,0x00,0x00,0x00, 420 421 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 422 423 0x00,0x00,0x00,0x00,0x00,0x00,0x1F,0xFF,0xFF,0xFE,0x00,0x00,0x00,0x00,0x00,0x00, 424 425 0x00,0x00,0x00,0x00,0x00,0x00,0x0F,0xFF,0xFF,0xFC,0x00,0x00,0x00,0x00,0x00,0x00, 426 427 0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xFF,0xFF,0xF8,0x00,0x00,0x00,0x00,0x00,0x00, 428 429 0x00,0x00,0x00,0x00,0x00,0x00,0x03,0xFF,0xFF,0xF0,0x00,0x00,0x00,0x00,0x00,0x00, 430 431 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0xFF,0xFF,0xC0,0x00,0x00,0x00,0x00,0x00,0x00, 432 433 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x3F,0xFF,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 434 435 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07,0xF8,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 436 437 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 438 439 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 440 441 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 442 443 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 444 445 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 446 447 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 448 449 0x00,0x00,0x00,0x00,0xF3,0xCF,0x9C,0x70,0x07,0x3E,0x73,0xCF,0x80,0x00,0x00,0x00, 450 451 0x00,0x00,0x00,0x00,0x8A,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 452 453 0x00,0x00,0x00,0x00,0x8A,0x28,0x20,0x80,0x08,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 454 455 0x00,0x00,0x00,0x00,0xF3,0xCF,0x1C,0x70,0x07,0x08,0x8B,0xC2,0x00,0x00,0x00,0x00, 456 457 0x00,0x00,0x00,0x00,0x82,0x48,0x02,0x08,0x00,0x88,0xFA,0x42,0x00,0x00,0x00,0x00, 458 459 0x00,0x00,0x00,0x00,0x82,0x28,0x22,0x88,0x08,0x88,0x8A,0x22,0x00,0x00,0x00,0x00, 460 461 0x00,0x00,0x00,0x00,0x82,0x2F,0x9C,0x70,0x07,0x08,0x8A,0x22,0x00,0x00,0x00,0x00, 462 463 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 464 465 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 466 467 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 468 469 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 470 471 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 472 473 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 474 475 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 476 477 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 478 479 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 480 481 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 482 483 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 484 485 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 486 487 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 488}; 489 490 491//game 492 over 493PROGMEM const unsigned char over[] = { 494 128, 64, //pictureresolution 495 496 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 497 498 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 499 500 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 501 502 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 503 504 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 505 506 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 507 508 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 509 510 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 511 512 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 513 514 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 515 516 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 517 518 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 519 520 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 521 522 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 523 524 0x00,0x0F,0xE0,0x00,0x01,0xFF,0x00,0x07,0xFC,0x00,0x1F,0xF0,0x00,0x7F,0xC0,0x00, 525 526 0x00,0x3F,0xF8,0x00,0x03,0xFF,0x80,0x0F,0xFE,0x00,0x3F,0xF8,0x00,0xFF,0xE0,0x00, 527 528 0x00,0x7F,0xFC,0x00,0x07,0xFF,0xC0,0x1F,0xFF,0x00,0x7F,0xFC,0x01,0xFF,0xF0,0x00, 529 530 0x00,0xFE,0x7E,0x00,0x0F,0xFF,0xE0,0x3F,0xFF,0x80,0xFF,0xFE,0x03,0xFF,0xF8,0x00, 531 532 0x01,0xFE,0x7F,0x00,0x00,0xF8,0x70,0x03,0xE1,0xC0,0x0F,0x87,0x00,0x3E,0x1C,0x00, 533 534 0x00,0x7F,0xFF,0x00,0x1E,0xF7,0x70,0x7B,0xDD,0xC1,0xEF,0x77,0x07,0xBD,0xDC,0x00, 535 536 0x00,0x0F,0xFF,0x80,0x1F,0x77,0xB0,0x7D,0xDE,0xC1,0xF7,0x7B,0x07,0xDD,0xEC,0x00, 537 538 0x00,0x01,0xFF,0x80,0x23,0x71,0xB0,0x8D,0xC6,0xC2,0x37,0x1B,0x08,0xDC,0x6C,0x00, 539 540 0x00,0x00,0x1F,0x80,0x23,0x71,0xB8,0x8D,0xC6,0xE2,0x37,0x1B,0x88,0xDC,0x6E,0x00, 541 542 0x00,0x00,0x1F,0x80,0x23,0x71,0xB8,0x8D,0xC6,0xE2,0x37,0x1B,0x88,0xDC,0x6E,0x00, 543 544 0x00,0x01,0xFF,0x80,0x2E,0xF7,0x78,0xBB,0xDD,0xE2,0xEF,0x77,0x8B,0xBD,0xDE,0x00, 545 546 0x00,0x0F,0xFF,0x80,0x31,0xF8,0xF8,0xC7,0xE3,0xE3,0x1F,0x8F,0x8C,0x7E,0x3E,0x00, 547 548 0x00,0x7F,0xFF,0x80,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 549 550 0x01,0xFF,0xFF,0x00,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 551 552 0x01,0xFF,0xFE,0x00,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 553 554 0x00,0x7F,0xFC,0x00,0x3F,0xFF,0xF8,0xFF,0xFF,0xE3,0xFF,0xFF,0x8F,0xFF,0xFE,0x00, 555 556 0x00,0x1F,0xF8,0x00,0x3F,0xE7,0xF8,0xFF,0x9F,0xE3,0xFE,0x7F,0x8F,0xF9,0xFE,0x00, 557 558 0x00,0x0F,0xE0,0x00,0x39,0xC7,0x98,0xE7,0x1E,0x63,0x9C,0x79,0x8E,0x71,0xE6,0x00, 559 560 0x00,0x00,0x00,0x00,0x20,0xC7,0x08,0x83,0x1C,0x22,0x0C,0x70,0x88,0x31,0xC2,0x00, 561 562 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 563 564 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 565 566 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 567 568 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 569 570 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 571 572 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 573 574 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 575 576 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 577 578 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 579 580 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 581 582 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 583 584 0x00,0x00,0x00,0x00,0x03,0x8E,0x45,0xF0,0x0E,0x45,0xF7,0x80,0x00,0x00,0x00,0x00, 585 586 0x00,0x00,0x00,0x00,0x04,0x51,0x6D,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 587 588 0x00,0x00,0x00,0x00,0x04,0x11,0x55,0x00,0x11,0x45,0x04,0x40,0x00,0x00,0x00,0x00, 589 590 0x00,0x00,0x00,0x00,0x05,0xD1,0x45,0xE0,0x11,0x45,0xE7,0x80,0x00,0x00,0x00,0x00, 591 592 0x00,0x00,0x00,0x00,0x04,0x5F,0x45,0x00,0x11,0x45,0x04,0x80,0x00,0x00,0x00,0x00, 593 594 0x00,0x00,0x00,0x00,0x04,0x51,0x45,0x00,0x11,0x29,0x04,0x40,0x00,0x00,0x00,0x00, 595 596 0x00,0x00,0x00,0x00,0x03,0xD1,0x45,0xF0,0x0E,0x11,0xF4,0x40,0x00,0x00,0x00,0x00, 597 598 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 599 600 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 601 602 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 603 604 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 605 606 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 607 608 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 609 610 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 611 612 0x3D,0xEF,0x7B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 613 614 0x21,0x09,0x4A,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 615 616 0x3D,0x09,0x7B,0x80,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 617 618 0x05,0x09,0x52,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 619 620 0x3D,0xEF,0x4B,0xD0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00, 621 622 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00 623}; 624 625//logo 626PROGMEM 627 const unsigned char logo[] = { 628 128, 32, //pictureresolution 629 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0, 630 631 0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF0, 632 633 0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C, 634 635 0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x1C, 636 637 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E, 638 639 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 640 641 0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07, 642 643 0xC0,0xFF,0xC0,0x00,0x00,0x7F,0x80,0x00,0x00,0x00,0x00,0x01,0x00,0x00,0x7F,0x03, 644 645 0xC0,0xFF,0xF0,0x18,0x00,0xFF,0xE0,0x00,0x03,0x00,0x0C,0x03,0x80,0x60,0x7F,0x03, 646 647 0xC0,0xFF,0xF8,0x3C,0x01,0xFF,0xF0,0x00,0x03,0x80,0x1C,0x03,0x80,0x70,0x7F,0x03, 648 649 0xC0,0xFF,0xF8,0x3C,0x03,0xFF,0xF8,0x00,0x03,0xC0,0x3C,0x07,0xC0,0x78,0x7F,0x03, 650 651 0xC0,0xFF,0xFC,0x7E,0x03,0xFF,0xFC,0x00,0x03,0xE0,0x7C,0x07,0xC0,0x7C,0x7F,0x03, 652 653 0xC0,0xFF,0xFC,0x7E,0x07,0xFF,0xF8,0x00,0x03,0xF0,0xFC,0x0F,0xE0,0x7E,0x7F,0x03, 654 655 0xC0,0xFE,0xFC,0xFF,0x07,0xFF,0xC0,0x7F,0x03,0xF8,0xFC,0x0F,0xF0,0x7F,0x7F,0x03, 656 657 0xC0,0xFF,0xFC,0xFF,0x8F,0xFF,0x00,0x7F,0xC3,0xFD,0xFC,0x1F,0xF0,0x7F,0x7F,0x03, 658 659 0xC0,0xFF,0xFD,0xFF,0x8F,0xFE,0x00,0x7F,0xC3,0xFF,0xFC,0x3F,0xF8,0x7F,0xFF,0x03, 660 661 0xC0,0xFF,0xF9,0xFF,0xCF,0xFC,0x00,0x3F,0xC3,0xFF,0xFC,0x3F,0xF8,0x7F,0xFF,0x03, 662 663 0xC0,0xFF,0xFB,0xE7,0xC7,0xFF,0x00,0x3F,0xC3,0xFF,0xFC,0x7E,0x7C,0x7F,0xFF,0x03, 664 665 0xC0,0xFF,0xF3,0xFF,0xE7,0xFF,0xF0,0x00,0x03,0xFF,0xFC,0x7F,0xFC,0x7F,0xFF,0x03, 666 667 0xC0,0xFE,0x07,0xFF,0xE7,0xFF,0xFC,0x00,0x03,0xFF,0xFC,0xFF,0xFE,0x7F,0xFF,0x03, 668 669 0xC0,0xFE,0x07,0xFF,0xE3,0xFF,0xFC,0x00,0x03,0xFF,0xFC,0xFF,0xFE,0x7F,0xFF,0x03, 670 671 0xC0,0xFE,0x0F,0xFF,0xF1,0xFF,0xFC,0x00,0x03,0xFF,0xFC,0xFF,0xFF,0x7F,0xFF,0x03, 672 673 0xC0,0xFE,0x0F,0xFF,0xB9,0xFF,0xF8,0x00,0x03,0xFF,0xDD,0xFF,0xF7,0x3F,0xF7,0x03, 674 675 0xC0,0xFE,0x0F,0xFF,0xB8,0x7F,0xF0,0x00,0x03,0xFF,0xDD,0xFF,0xF7,0xBF,0xF7,0x03, 676 677 0xC0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x03, 678 679 0xE0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x07, 680 681 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 682 683 0x60,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x06, 684 685 0x70,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x0E, 686 687 0x3E,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x7C, 688 689 0x1F,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xF8, 690 691 0x03,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xC0 692}; 693
TVpacman.ino
arduino
1/************************************************************************** 2 * 3 * ARDUINO PAC-MAN 1.2 4 * 5 * Jan/2022 Giovanni Verrua 6 * 7 * This program is free software: you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License as published by 9 * the Free Software Foundation, either version 3 of the License, or 10 * (at your option) any later version. 11 * 12 * This program is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 15 * GNU General Public License for more details. 16 * 17 * You should have received a copy of the GNU General Public License 18 * along with this program. If not, see <https://www.gnu.org/licenses/>. 19 * 20 * NOTE: The code isn't optimized. I know that, it could be wrote 21 * in less lines and some choices I made are quite awful. 22 * The main reason is that I wrote it learning Arduino, so I 23 * preferred a code easy to read than a more compact code. 24 * 25 * Also, I faced many strange problems. In example, a simple 26 * variable declaration, an IF sentence, etc. in some cases prevented 27 * the Arduino Nano from boot. Specifically, I couldn't use the 28 * TV.print() function (that's the reason to use bitmap for the score 29 * and the lives) and I also have had serious troubles where the 30 * ghosts slow the speed when they are "haunted" (I mean: when you eat 31 * the magic pill, also called "happy hour" in the comments ;-) or to 32 * make them flashing at the 3 last seconds of the happy hour. 33 * 34 * So, forgive the sometimes strange code, but I've lost more time 35 * trying to fix this kind of problems than to wrote the whole code. 36 * 37 * -- I wrote the game from scratch instead to port it from another 38 * platform. Since I'm not a game designer and honestly I have 39 * no skill about that, I'm sure there's a better way to 40 * write the ghosts AI. My ghosts are AI: Artificially Idiots. 41 * Sorry for that. 42 * 43 * Connections to Arduino Uno/Nano: 44 * 45 * Connect buttons to: pin 2 and +5V (button up), 46 * pin 3 and +5V (button down), 47 * pin 4 and +5V (button left), 48 * pin 5 and +5V (but.right), 49 * pin 6 and +5V (button Fire / Start) 50 * 51 * (note: you can use an Atari compatible Joystick too) 52 * 53 * Connect 100 kohm pulldown resistors between pin 2 and GND, 54 * pin 3 and GND, 55 * pin 4 and GND, 56 * pin 5 and GND, 57 * pin 6 and GND 58 * 59 * TV composite out: 60 * Connect 1k ohm resistor from pin 9 to TV out (+) 61 * Connect 470 ohm resistor from pin 7 to TV out (+) 62 * Connect GND to TV out (-) 63 * 64 * Audio: 65 * Connect a speaker between pin 11 and GND 66 * 67 **************************************************************************/ 68 69#include <TVout.h> 70#include <fontALL.h> 71#include "bitmap.h" 72#include "pitches.h" 73 74 75//You can use buttons or a Joystick Atari compatible 76#define BUTTON_UP 2 77#define BUTTON_DOWN 3 78#define BUTTON_LEFT 4 79#define BUTTON_RIGHT 5 80#define BUTTON_START 6 //digital - button 81 82#define PAC_STARTX 48 //pacman X position 83#define PAC_STARTY 61 //pacman Y position 84 85 86#define GAME_SPEED 30 //higher value, lower speed 87#define GHOST_RELEASE_DELAY 1000 //how many millisec between 2 ghosts release 88 89#define HOWMANYGHOSTS 4 //USED FOR DEBUG. MAX 4 GHOSTS (UNLESS YOU CHANGE THE GHOSTS ARRAY DECLARATIONS AND RESET) 90#define EATGHOSTSECS 10 //TIME ALLOWED TO EAT GHOSTS (HAPPY HOUR) 91 92 93TVout TV; 94 95int Score = 0; 96int lives = 3; 97 98int gamSt = 0; //0 = menu, 1 = in game, 2 = game over 99 100int FoodPosY[8] = {5,15,25,35,55,65,75,85}; 101 102int FoodPosX[12] = { 5, 15, 25, 34, 44, 59, 70, 84, 94,103,113,122}; 103 104//This declaration is just for explaining how the food and pills are. 105//if you need to modify something, must change in reset_food() too. 106int FoodMatr[8][12] = { { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //5 107 { 2, 0, 1, 0, 1, 1, 1, 1, 0, 1, 0, 2}, //15 108 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //25 109 { 1, 1, 1, 1, 0, 0, 0, 0, 1, 1, 1, 1}, //35 110 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //55 111 { 1, 2, 1, 1, 1, 1, 1, 1, 1, 1, 2, 1}, //65 112 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}, //75 113 { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} }; //85 114 115 116 int gstPosX [4] = {51,52,53,54}; //ghosts position 117 int gstPosY [4] = {41,41,41,41}; //ghosts position 118 int gstDire [4] = {1,1,1,1}; //ghosts direction 0=north, 1=east, 2=south, 3=west 119 120 121//===================================================================================== JINGLE 122void Jingle(){ //Playing pac-man jingle 123 124TV.tone(NOTE_B4 ,100); delay(120); 125TV.tone(NOTE_B5 ,100); delay(120); 126TV.tone(NOTE_FS5,100); delay(120); 127TV.tone(NOTE_DS5,100); delay(120); 128TV.tone(NOTE_FS5,120); delay(200); 129TV.tone(NOTE_DS5,150); delay(250); 130 131TV.tone(NOTE_C5 ,100); delay(120); 132TV.tone(NOTE_C6 ,100); delay(120); 133TV.tone(NOTE_G5 ,100); delay(120); 134TV.tone(NOTE_E5 ,100); delay(120); 135TV.tone(NOTE_C6 ,120); delay(200); 136TV.tone(NOTE_G5 ,150); delay(250); 137 138TV.tone(NOTE_B4 ,100); delay(120); 139TV.tone(NOTE_B5 ,100); delay(120); 140TV.tone(NOTE_FS5,100); delay(120); 141TV.tone(NOTE_DS5,100); delay(120); 142TV.tone(NOTE_B5 ,120); delay(200); 143TV.tone(NOTE_FS5,150); delay(250); 144 145TV.tone(NOTE_DS5,100); delay(120); 146TV.tone(NOTE_DS5,100); delay(120); 147TV.tone(NOTE_E5 ,100); delay(120); 148TV.tone(NOTE_F5 ,100); delay(120); 149TV.tone(NOTE_F5 ,100); delay(120); 150TV.tone(NOTE_FS5,100); delay(120); 151TV.tone(NOTE_G5 ,100); delay(120); 152TV.tone(NOTE_G5 ,100); delay(120); 153TV.tone(NOTE_GS5,100); delay(120); 154TV.tone(NOTE_A5 ,100); delay(120); 155TV.tone(NOTE_B5 ,100); delay(120); 156} 157 158 159 160//===================================================================================== RESET_GHOST 161void reset_ghosts() { 162 163 gstPosX[0] = 51; gstPosX[1] = 52; gstPosX[2] = 53; gstPosX[3] = 54; //ghosts position 164 gstPosY[0] = 41; gstPosY[1] = 41; gstPosY[2] = 41; gstPosY[3] = 41; //ghosts position 165 gstDire[0] = 1; gstDire[1] = 1; gstDire[2] = 1; gstDire[3] = 1; //ghosts direction 0=north, 1=east, 2=south, 3=west 166 167} 168 169//===================================================================================== DRAW_FOOD 170void draw_food() { 171 for (int i=0;i<12;i++){ 172 for (int j=0;j<8;j++){ 173 174 if (FoodMatr[j][i] == 1) { //food 175 TV.set_pixel(FoodPosX[i],FoodPosY[j],1); 176 } 177 178 if (FoodMatr[j][i] == 2) { //pill 179 TV.set_pixel(FoodPosX[i]-1,FoodPosY[j]+1,1); 180 TV.set_pixel(FoodPosX[i]-1,FoodPosY[j]-1,1); 181 TV.set_pixel(FoodPosX[i]+1,FoodPosY[j]-1,1); 182 TV.set_pixel(FoodPosX[i]+1,FoodPosY[j]+1,1); 183 } 184 185 } 186 } 187} 188 189//===================================================================================== RESET_FOOD 190void reset_food() { 191 192 //I tried with a const array for initialization, but i got strange behaviors. I'm sure it's my fault. This isn't elegant but at least it works LOL 193 FoodMatr[0][0]=1; FoodMatr[0][1]=1; FoodMatr[0][2]=1; FoodMatr[0][3]=1; FoodMatr[0][4]=1; FoodMatr[0][5]=1; FoodMatr[0][6]=1; FoodMatr[0][7]=1; FoodMatr[0][8]=1; FoodMatr[0][9]=1; FoodMatr[0][10]=1; FoodMatr[0][11]=1 ; 194 FoodMatr[1][0]=2; FoodMatr[1][1]=0; FoodMatr[1][2]=1; FoodMatr[1][3]=0; FoodMatr[1][4]=1; FoodMatr[1][5]=1; FoodMatr[1][6]=1; FoodMatr[1][7]=1; FoodMatr[1][8]=0; FoodMatr[1][9]=1; FoodMatr[1][10]=0; FoodMatr[1][11]=2 ; 195 FoodMatr[2][0]=1; FoodMatr[2][1]=1; FoodMatr[2][2]=1; FoodMatr[2][3]=1; FoodMatr[2][4]=1; FoodMatr[2][5]=1; FoodMatr[2][6]=1; FoodMatr[2][7]=1; FoodMatr[2][8]=1; FoodMatr[2][9]=1; FoodMatr[2][10]=1; FoodMatr[2][11]=1 ; 196 FoodMatr[3][0]=1; FoodMatr[3][1]=1; FoodMatr[3][2]=1; FoodMatr[3][3]=1; FoodMatr[3][4]=0; FoodMatr[3][5]=0; FoodMatr[3][6]=0; FoodMatr[3][7]=0; FoodMatr[3][8]=1; FoodMatr[3][9]=1; FoodMatr[3][10]=1; FoodMatr[3][11]=1 ; 197 FoodMatr[4][0]=1; FoodMatr[4][1]=1; FoodMatr[4][2]=1; FoodMatr[4][3]=1; FoodMatr[4][4]=1; FoodMatr[4][5]=1; FoodMatr[4][6]=1; FoodMatr[4][7]=1; FoodMatr[4][8]=1; FoodMatr[4][9]=1; FoodMatr[4][10]=1; FoodMatr[4][11]=1 ; 198 FoodMatr[5][0]=1; FoodMatr[5][1]=2; FoodMatr[5][2]=1; FoodMatr[5][3]=1; FoodMatr[5][4]=1; FoodMatr[5][5]=1; FoodMatr[5][6]=1; FoodMatr[5][7]=1; FoodMatr[5][8]=1; FoodMatr[5][9]=1; FoodMatr[5][10]=2; FoodMatr[5][11]=1 ; 199 FoodMatr[6][0]=1; FoodMatr[6][1]=1; FoodMatr[6][2]=1; FoodMatr[6][3]=1; FoodMatr[6][4]=1; FoodMatr[6][5]=1; FoodMatr[6][6]=1; FoodMatr[6][7]=1; FoodMatr[6][8]=1; FoodMatr[6][9]=1; FoodMatr[6][10]=1; FoodMatr[6][11]=1 ; 200 FoodMatr[7][0]=1; FoodMatr[7][1]=1; FoodMatr[7][2]=1; FoodMatr[7][3]=1; FoodMatr[7][4]=1; FoodMatr[7][5]=1; FoodMatr[7][6]=1; FoodMatr[7][7]=1; FoodMatr[7][8]=1; FoodMatr[7][9]=1; FoodMatr[7][10]=1; FoodMatr[7][11]=1 ; 201 202} 203 204//===================================================================================== SETUP 205void setup() { 206 207 TV.begin(_PAL); //128x96 default 208 209 pinMode(BUTTON_UP,INPUT); 210 pinMode(BUTTON_DOWN,INPUT); 211 pinMode(BUTTON_LEFT,INPUT); 212 pinMode(BUTTON_RIGHT,INPUT); 213 pinMode(BUTTON_START,INPUT); 214 215 gamSt = 0; 216} 217 218//===================================================================================== DRAW_SCORE 219//for some reason I can't use the tv.print() function: it hangs the sketch 220//(it compiles fine but after upload it doesn't start). So I must to write the 221//score using bitmaps. 222 223void draw_score() { 224 225 int pos = 30; 226 int num = 0; 227 int zero = 0; 228 229 int a = Score /10; 230 int b = Score /100; 231 int c = Score /1000; 232 int d = Score /10000; 233 234 num = d; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 235 num = c-d*10; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 236 num = b-c*10; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 237 num = a-b*10; if (num > 0 || zero !=0 ) { draw_numbers(num,pos); pos+=8; zero = 1; } 238 num = Score-a*10; draw_numbers(num,pos); 239 240} 241 242//===================================================================================== DRAW_NUMBERS 243//for some reason I can't use the tv.print() function: it hangs the sketch 244//(it compiles fine but after upload it doesn't start). So I must to write the 245//score using bitmaps. 246void draw_numbers(uint8_t num, uint8_t pos ) { 247 248 if (num == 0) TV.bitmap( pos,88,nu0); 249 if (num == 1) TV.bitmap( pos,88,nu1); 250 if (num == 2) TV.bitmap( pos,88,nu2); 251 if (num == 3) TV.bitmap( pos,88,nu3); 252 if (num == 4) TV.bitmap( pos,88,nu4); 253 if (num == 5) TV.bitmap( pos,88,nu5); 254 if (num == 6) TV.bitmap( pos,88,nu6); 255 if (num == 7) TV.bitmap( pos,88,nu7); 256 if (num == 8) TV.bitmap( pos,88,nu8); 257 if (num == 9) TV.bitmap( pos,88,nu9); 258 259} 260 261 262//===================================================================================== COLLISION 263unsigned char collision(uint8_t x, uint8_t y, uint8_t dir) { 264 265 //-----------------------------------------------------------------------------------------------------north 266 if (dir == 0){ 267 if ( TV.get_pixel(x,y-1)==1 || TV.get_pixel(x+7,y-1)==1 ) return 1; 268 for (int i=1;i<6;i++){ 269 if ( TV.get_pixel(x+i,y-1)==1 && TV.get_pixel(x+i+1,y-1)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 270 } 271 } 272 273 //-----------------------------------------------------------------------------------------------------east 274 if (dir == 1){ 275 if ( TV.get_pixel(x+8,y)==1 || TV.get_pixel(x+8,y+7)==1 ) return 1; 276 for (int i=1;i<6;i++){ 277 if ( TV.get_pixel(x+8,y+i)==1 && TV.get_pixel(x+8,y+i+1)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 278 } 279 } 280 281 //-----------------------------------------------------------------------------------------------------south 282 if (dir == 2){ 283 if ( TV.get_pixel(x,y+8)==1 || TV.get_pixel(x+7,y+8)==1 ) return 1; 284 for (int i=1;i<6;i++){ 285 if ( TV.get_pixel(x+i,y+8)==1 && TV.get_pixel(x+i+1,y+8)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 286 } 287 } 288 289 //-----------------------------------------------------------------------------------------------------west 290 if (dir == 3){ 291 if ( TV.get_pixel(x-1,y)==1 || TV.get_pixel(x-1,y+7)==1 ) return 1; 292 for (int i=1;i<6;i++){ 293 if ( TV.get_pixel(x-1,y+i)==1 && TV.get_pixel(x-1,y+i+1)==1 ) return 1; //must to have at least 2 pixel in front of it to represent a wall (1 pixel represent food or pill) 294 } 295 } 296 297 return 0; 298} 299 300//===================================================================================== LOOP 301void loop() { 302 303 bool every_2 = false; 304 //-----------------------------------------------------------------------------------------------------MENU 305 if (gamSt == 0){ //MENU 306 307 TV.clear_screen(); 308 TV.bitmap(0, 0, logo); 309 TV.bitmap(0, 33, start); 310 311 delay(1000); 312 313 while ( digitalRead(BUTTON_START) == 0){} 314 gamSt = 1; 315 delay(300); 316 317 } 318 319 320 //-----------------------------------------------------------------------------------------------------IN GAME 321 322 if (gamSt == 1){ // IN GAME 323 324 Score = 0; 325 lives = 3; 326 327 //--------------------------------- 328 //drawing once the grid and the food before the jingle() - not needed, just for show 329 TV.clear_screen(); 330 TV.bitmap(00,00,grid); 331 reset_food(); 332 draw_food(); 333 Jingle(); 334 //--------------------------------- 335 336 337 while (lives > 0){ 338 339 int eatGhosts = 0; 340 int oldDire = 1; //old pacman direction 341 342 unsigned long mill = millis() ; //delay - aliens 343 unsigned long relg = millis() ; //delay - release ghosts 344 unsigned long eatg = millis() ; //delay - eat ghosts 345 346 347 int pacPosX = PAC_STARTX; //pacman X position 348 int pacPosY = PAC_STARTY; //pacman Y position 349 int pacDire = 1; //pacman direction 0=north, 1=east, 2=south, 3=west > changing with wheel or buttons 350 351 int ghChg[4] = {0,0,0,0}; //ghost change direction 352 int ghSts[4] = {0,0,0,0}; //ghost status (1=eaten, 0=alive) - when eatGhosts = 1 353 354 355 int endfood = 0; // 0 = all eaten, 1 = some food/pills left yet 356 int gotcha = 0; 357 int numofgh = 0; 358 359 endfood = 1; 360 361 TV.clear_screen(); 362 TV.bitmap(00,00,grid); 363 364 reset_ghosts(); 365 reset_food(); 366 draw_food(); 367 368 //-----------------------------------------------------------------------------------------------------Main Cycle-begin-\\ 369 370 while ( endfood != 0 && lives > 0 ) { 371 372 if (mill + GAME_SPEED < millis()){ //the game move all at the same speed 373 374 if (every_2 ) every_2 = false; else every_2 = true; 375 376 if ( numofgh < HOWMANYGHOSTS && relg + GHOST_RELEASE_DELAY < millis() ) { numofgh++; relg = millis(); } 377 378 379 //----------------------------------------------------------------------------------------------\ 380 //DON'T MOVE THIS PART FROM HERE! IT MUST TO DELETE ALL THE GHOSTS BEFORE TO CHECK THE OBSTACLES 381 //OR THE GHOSTS WILL BE CONFUSED BY THE PRESENCE OF OTHER GHOSTS!!! 382 for (int i=0;i<numofgh;i++){ 383 TV.bitmap(gstPosX[i],gstPosY[i],blk); //delete all ghosts before to check obstacles. 384 } 385 TV.bitmap(pacPosX,pacPosY,blk); 386 //----------------------------------------------------------------------------------------------/ 387 388 389 //----------------------------------------------------3 secs to the end of happy hour! Ghosts are flashing 390 if (eatGhosts == 1 && eatg + EATGHOSTSECS*1000 -3000 < millis()) { 391 eatGhosts = 2; 392 } 393 394 //----------------------------------------------------end of happy hour! Ghosts are hunting you again! 395 if (eatGhosts > 0 && eatg + EATGHOSTSECS*1000 < millis()) { 396 eatGhosts = 0; 397 ghSts[0] = 0; ghSts[1] = 0; ghSts[2] = 0; ghSts[3] = 0; 398 } 399 400 //----------------------------------------------------------------------------------------------\ 401 402 oldDire = pacDire ; 403 if ( digitalRead(BUTTON_UP ) == 1) pacDire = 0; //north 404 if ( digitalRead(BUTTON_RIGHT) == 1) pacDire = 1; //east 405 if ( digitalRead(BUTTON_DOWN ) == 1) pacDire = 2; //south 406 if ( digitalRead(BUTTON_LEFT ) == 1) pacDire = 3; //west 407 408 if (collision(pacPosX,pacPosY,pacDire) == 1 && pacDire != oldDire ) pacDire = oldDire ; 409 410 if (collision(pacPosX,pacPosY,pacDire) == 0){ 411 412 if (pacDire == 0) pacPosY--; 413 if (pacDire == 1) pacPosX++; 414 if (pacDire == 2) pacPosY++; 415 if (pacDire == 3) pacPosX--; 416 417 if (pacPosX > 120) pacPosX = 0; 418 if (pacPosX < 0) pacPosX = 120; 419 420 //------------------------------------------------------------------------------------------------------check food/pills 421 endfood = 0; 422 for (int i=0;i<12;i++){ 423 for (int j=0;j<8;j++){ 424 if (FoodMatr[j][i] == 1 || FoodMatr[j][i] == 2 ) { 425 endfood = 1; //still some food / pills to eat 426 427 //-------------------------------------------------------------------------------------------------------food 428 if (FoodPosX[i] >= pacPosX && FoodPosX[i] <= pacPosX+7 && FoodPosY[j] >= pacPosY && FoodPosY[j] <= pacPosY+7) { 429 if (FoodMatr[j][i] == 1) { 430 FoodMatr[j][i] = 0; 431 Score ++; 432 TV.tone(NOTE_G1, 50); 433 } 434 if (FoodMatr[j][i] == 2) { 435 FoodMatr[j][i] = 0; 436 Score += 10; 437 eatGhosts = 1; 438 eatg = millis() ; 439 TV.tone(NOTE_B5, 50); 440 } 441 } 442 //-------------------------------------------------------------------------------------------------------pill 443 } 444 } 445 } 446 447 if (endfood == 0) Jingle(); 448 } 449 450 451 //----------------------------------------------------------------------------------------------/ 452 453 //----------------------------------------------------------------------------------------------pac vs ghost collision 454 gotcha = 0; 455 456 for (int i=0;i<numofgh;i++){ 457 458 if (eatGhosts == 0 || ghSts[i] == 0) { 459 460 //ghost coming from north 461 if ( gstPosY[i] <=pacPosY && gstPosY[i]+8 >=pacPosY && ( (gstPosX[i] >=pacPosX && gstPosX[i]+7 <=pacPosX) || (gstPosX[i] <=pacPosX && gstPosX[i]+7 >=pacPosX) ) ) { gotcha = i+1; i == numofgh; } 462 463 //ghost coming from south 464 if ( pacPosY <=gstPosY[i] && pacPosY +8 >=gstPosY[i] && ( (gstPosX[i] >=pacPosX && gstPosX[i]+7 <=pacPosX) || (gstPosX[i] <=pacPosX && gstPosX[i]+7 >=pacPosX) ) ) { gotcha = i+1; i == numofgh; } 465 466 //ghost coming from west 467 if ( gstPosX[i] <=pacPosX && gstPosX[i]+8 >=pacPosX && ( (gstPosY[i] >=pacPosY && gstPosY[i]+7 <=pacPosY) || (gstPosY[i] <=pacPosY && gstPosY[i]+7 >=pacPosY) ) ) { gotcha = i+1; i == numofgh; } 468 469 //ghost coming from south 470 if ( pacPosX <=gstPosX[i] && pacPosX +8 >=gstPosX[i] && ( (gstPosY[i] >=pacPosY && gstPosY[i]+7 <=pacPosY) || (gstPosY[i] <=pacPosY && gstPosY[i]+7 >=pacPosY) ) ) { gotcha = i+1; i == numofgh; } 471 } 472 } 473 474 if (gotcha > 0 ) { 475 476 if (eatGhosts == 0) { 477 //------------------------------------------------------------- the got you! ---------- 478 lives --; 479 480 for (int i=0;i<5;i++){ 481 TV.tone(NOTE_G1*(5-i)*10, 100); 482 TV.bitmap(pacPosX,pacPosY,p1w); delay(50) ; 483 TV.bitmap(pacPosX,pacPosY,p1s); delay(50) ; 484 TV.bitmap(pacPosX,pacPosY,p1e); delay(50) ; 485 TV.bitmap(pacPosX,pacPosY,p1n); delay(50) ; 486 } 487 delay(1000); 488 relg = millis() ; 489 pacPosX = PAC_STARTX; //pacman X position 490 pacPosY = PAC_STARTY; //pacman Y position 491 pacDire = 1; //pacman direction 0=north, 1=east, 2=south, 3=west > changing with wheel or buttons 492 oldDire = 1; //old pacman direction 493 494 ghChg[0] = 0; ghChg[1] = 0; ghChg[2] = 0; ghChg[3] = 0; //ghost change direction 495 gotcha = 0; 496 numofgh = 0; 497 498 if (lives >0) { 499 TV.clear_screen(); 500 TV.bitmap(00,00,grid); 501 draw_food(); 502 reset_ghosts(); 503 } 504 } 505 //------------------------------------------------------------- you got a ghost!------- 506 else { // eatGhosts == 1 507 TV.tone(NOTE_B6, 200); 508 gstPosX[gotcha-1] = 51; 509 gstPosY[gotcha-1] = 41; 510 Score += 20; 511 512 } 513 } 514 515 516 //---------------------------------------------------------------------------ghost moving-begin-\\ 517 518 for (int i=0;i<numofgh;i++){ //DEBUG //<4 ma bisogna capire come fare per differenziare le direzioni dei fantasmi 519 520 ghChg[i] = 0; 521 522 //direction 0=north, 1=east, 2=south, 3=west 523 524 //----------------------------------------------------------------------------------------north 525 if (gstDire[i]==0 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ // 526 if (pacPosX < gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 527 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } else { //n -> w 528 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } } //n -> e 529 } 530 else { 531 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } else { //n -> e 532 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } } //n -> w 533 } 534 if ( ghChg[i]==0 ) {gstDire[i]=2; ghChg[i] = 1; } //n -> s} //means it can only go back 535 } 536 //----------------------------------------------------------------------------------------east 537 if (gstDire[i]==1 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ 538 if (pacPosY > gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 539 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } else { //e -> s 540 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } } //e -> n 541 } 542 else { 543 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } else { //e -> n 544 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } } //e -> s 545 } 546 if ( ghChg[i]==0 ) {gstDire[i]=3; ghChg[i] = 1; } //e -> w} //means it can only go back 547 } 548 //----------------------------------------------------------------------------------------south 549 if (gstDire[i]==2 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ 550 if (pacPosX > gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 551 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } else { //s -> e 552 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } } //s -> w 553 } 554 else { 555 if (collision(gstPosX[i],gstPosY[i],3) == 0) { gstDire[i] = 3; ghChg[i] = 1; } else { //s -> w 556 if (collision(gstPosX[i],gstPosY[i],1) == 0) { gstDire[i] = 1; ghChg[i] = 1; } } //s -> e 557 } 558 if ( ghChg[i]==0 ) {gstDire[i]=0; ghChg[i] = 1; } //s -> n} //means it can only go back 559 } 560 //----------------------------------------------------------------------------------------west 561 if (gstDire[i]==3 && ghChg[i]==0 && collision(gstPosX[i],gstPosY[i],gstDire[i]) == 1){ 562 if (pacPosY < gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 563 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } else { //w -> n 564 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } } //w -> s 565 } 566 else { 567 if (collision(gstPosX[i],gstPosY[i],2) == 0) { gstDire[i] = 2; ghChg[i] = 1; } else { //w -> s 568 if (collision(gstPosX[i],gstPosY[i],0) == 0) { gstDire[i] = 0; ghChg[i] = 1; } } //w -> n 569 } 570 if ( ghChg[i]==0 ) {gstDire[i]=1; ghChg[i] = 1; } //w -> e} //means it can only go back 571 } 572 573 574 } //next i 575 576 577 578 for (int i=0;i<numofgh;i++){ 579 580 581 if (ghChg[i]==0 && random(1,3) == 1){ 582 583 //----------------------------------------------------------------------------------------west 584 if (gstDire[i]==3 && ghChg[i]==0){ //west 585 if (pacPosY < gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 586 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //w -> n 587 if (random(1,5)==2){ 588 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //w -> s 589 } 590 } 591 else { 592 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //w -> s 593 if (random(1,5)==2){ 594 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //w -> n 595 } 596 } 597 } 598 599 //----------------------------------------------------------------------------------------north 600 if (gstDire[i]==0 && ghChg[i]==0){ //north 601 if (pacPosX < gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 602 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //n -> e 603 if (random(1,5)==2){ 604 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //n -> w 605 } 606 } 607 608 else { 609 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //n -> w 610 if (random(1,5)==2){ 611 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //n -> e 612 } 613 } 614 } 615 616 //----------------------------------------------------------------------------------------east 617 if (gstDire[i]==1 && ghChg[i]==0){ //east 618 if (pacPosY > gstPosY[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 619 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //e -> s 620 if (random(1,5)==2){ 621 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //e -> n 622 } 623 } 624 else { 625 if ( collision(gstPosX[i],gstPosY[i],0) == 0 && ghChg[i]==0) {gstDire[i]=0;ghChg[i] = 1; } //e -> n 626 if (random(1,5)==2){ 627 if ( collision(gstPosX[i],gstPosY[i],2) == 0 && ghChg[i]==0) {gstDire[i]=2;ghChg[i] = 1; } //e -> s 628 } 629 } 630 } 631 632 //----------------------------------------------------------------------------------------south 633 if (gstDire[i]==2 && ghChg[i]==0){ //south 634 if (pacPosX > gstPosX[i] && eatGhosts == 0){ //if (random(1,3) == 1){ 635 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //s -> w 636 if (random(1,5)==2){ 637 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //s -> e 638 } 639 } 640 else { 641 if ( collision(gstPosX[i],gstPosY[i],1) == 0 && ghChg[i]==0) {gstDire[i]=1;ghChg[i] = 1; } //s -> e 642 if (random(1,5)==2){ 643 if ( collision(gstPosX[i],gstPosY[i],3) == 0 && ghChg[i]==0) {gstDire[i]=3;ghChg[i] = 1; } //s -> w 644 } 645 } 646 } 647 648 649 } 650 651 652 //--------------------------------------------------------------------------------------don't touch the code or will hang Arduino begin ---\\ 653 //I know that the code isn't optimized and could be written in a more compact way; however if you will touch 654 //this part, even with replicated code, the sketch will hang the Arduino - it drove me crazy and this was 655 //the only way I succeded. If you find a better and working way, or can explain me how it hangs, please 656 //advise me. Thank you! 657 658 //if (eatGhosts == 0 && every_2 ) { this should work fine and avoid to replicate the IF; instead it hangs the sketch. 659 660 if (eatGhosts == 0 ) { //ghosts at normal speed (they're hunting you) 661 if (gstDire[i] == 0) gstPosY[i]--; 662 if (gstDire[i] == 1) gstPosX[i]++; 663 if (gstDire[i] == 2) gstPosY[i]++; 664 if (gstDire[i] == 3) gstPosX[i]--; 665 666 if (gstPosX[i] > 120) gstPosX[i] = 0; 667 if (gstPosX[i] < 0) gstPosX[i] = 120; 668 if (gstPosX[i] > 120) gstPosX[i] = 0; else if (gstPosX[i] < 0) gstPosX[i] = 120; 669 } 670 //------------------------------------------------------------------------------- 671 if ( eatGhosts > 0 && every_2 ) { //happy hour, the ghosts are haunted and move at half speed 672 if (gstDire[i] == 0) gstPosY[i]--; 673 if (gstDire[i] == 1) gstPosX[i]++; 674 if (gstDire[i] == 2) gstPosY[i]++; 675 if (gstDire[i] == 3) gstPosX[i]--; 676 677 if (gstPosX[i] > 120) gstPosX[i] = 0; 678 if (gstPosX[i] < 0) gstPosX[i] = 120; 679 if (gstPosX[i] > 120) gstPosX[i] = 0; else if (gstPosX[i] < 0) gstPosX[i] = 120; 680 } 681 682 //-----------------------------------------------------------------------draw ghosts 683 //Again, don't touch this part or the sketch will hang the Arduino! 684 685 if (eatGhosts == 0) { 686 if ( (gstPosX[i] % 2) - (gstPosY[i] % 2) == 0) TV.bitmap(gstPosX[i],gstPosY[i],g1n); 687 else TV.bitmap(gstPosX[i],gstPosY[i],g2n); 688 } 689 690 if (eatGhosts == 1) { 691 if ( (gstPosX[i] % 2) - (gstPosY[i] % 2) == 0) TV.bitmap(gstPosX[i],gstPosY[i],g1h); 692 else TV.bitmap(gstPosX[i],gstPosY[i],g2h); 693 } 694 695 if (eatGhosts == 2) { 696 if ( (gstPosX[i] % 2) - (gstPosY[i] % 2) == 0) TV.bitmap(gstPosX[i],gstPosY[i],g1h); 697 else TV.bitmap(gstPosX[i],gstPosY[i],g2n); 698 699 } 700 //--------------------------------------------------------------------------------------don't touch the code or will hang Arduino end -----/ 701 702 703 704 705 } //next i 706 //---------------------------------------------------------------------------ghost moving-end---/ 707 708 709 710 //--------------------------------------------------------------------------------------------------- draw Pac Man 711 if (pacDire == 0) { 712 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1n); } 713 else { TV.bitmap(pacPosX,pacPosY,p2n); } 714 } 715 if (pacDire == 1) { 716 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1e); } 717 else { TV.bitmap(pacPosX,pacPosY,p2e); } 718 } 719 if (pacDire == 2) { 720 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1s); } 721 else { TV.bitmap(pacPosX,pacPosY,p2s); } 722 } 723 if (pacDire == 3) { 724 if ( (pacPosX % 2) - (pacPosY % 2) == 0) { TV.bitmap(pacPosX,pacPosY,p1w); } 725 else { TV.bitmap(pacPosX,pacPosY,p2w); } 726 } 727 728 //--------------------------------------------------------------------------------------------------- 729 draw_food(); 730 draw_score(); 731 draw_numbers( lives, 118 ); 732 733 //------------------------------------------------------------ 734 mill = millis(); 735 } 736 737 738 //-----------------------------------------------------------------------------------------------------Main Cycle-end--- / 739 740 } //while endfood != 0 741 742 } //while lives >0 743 gamSt = 2 ; 744 } //if gamst == 1 745 746 //-----------------------------------------------------------------------------------------------------GAME OVER 747 if (gamSt == 2){ //GAME OVER 748 gamSt = 0; 749 TV.clear_screen(); 750 TV.bitmap(0, 0, logo); 751 TV.bitmap(0, 33, over); 752 753 draw_score(); 754 delay(1000); 755 756 //must to release and press again the button before to continue 757 while ( digitalRead(BUTTON_START) == 1){} 758 while ( digitalRead(BUTTON_START) == 0){} 759 760 } 761 762} 763
pitches.h
arduino
1/************************************************* 2 3 * Public Constants 4 5 *************************************************/ 6 7#define NOTE_B0 31 8#define NOTE_C1 33 9#define NOTE_CS1 35 10#define NOTE_D1 37 11#define NOTE_DS1 39 12#define NOTE_E1 41 13#define NOTE_F1 44 14#define NOTE_FS1 46 15#define NOTE_G1 49 16#define NOTE_GS1 52 17#define NOTE_A1 55 18#define NOTE_AS1 58 19#define NOTE_B1 62 20#define NOTE_C2 65 21#define NOTE_CS2 69 22#define NOTE_D2 73 23#define NOTE_DS2 78 24#define NOTE_E2 82 25#define NOTE_F2 87 26#define NOTE_FS2 93 27#define NOTE_G2 98 28#define NOTE_GS2 104 29#define NOTE_A2 110 30#define NOTE_AS2 117 31#define NOTE_B2 123 32#define NOTE_C3 131 33#define NOTE_CS3 139 34#define NOTE_D3 147 35#define NOTE_DS3 156 36#define NOTE_E3 165 37#define NOTE_F3 175 38#define NOTE_FS3 185 39#define NOTE_G3 196 40#define NOTE_GS3 208 41#define NOTE_A3 220 42#define NOTE_AS3 233 43#define NOTE_B3 247 44#define NOTE_C4 262 45#define NOTE_CS4 277 46#define NOTE_D4 294 47#define NOTE_DS4 311 48#define NOTE_E4 330 49#define NOTE_F4 349 50#define NOTE_FS4 370 51#define NOTE_G4 392 52#define NOTE_GS4 415 53#define NOTE_A4 440 54#define NOTE_AS4 466 55#define NOTE_B4 494 56#define NOTE_C5 523 57#define NOTE_CS5 554 58#define NOTE_D5 587 59#define NOTE_DS5 622 60#define NOTE_E5 659 61#define NOTE_F5 698 62#define NOTE_FS5 740 63#define NOTE_G5 784 64#define NOTE_GS5 831 65#define NOTE_A5 880 66#define NOTE_AS5 932 67#define NOTE_B5 988 68#define NOTE_C6 1047 69#define NOTE_CS6 1109 70#define NOTE_D6 1175 71#define NOTE_DS6 1245 72#define NOTE_E6 1319 73#define NOTE_F6 1397 74#define NOTE_FS6 1480 75#define NOTE_G6 1568 76#define NOTE_GS6 1661 77#define NOTE_A6 1760 78#define NOTE_AS6 1865 79#define NOTE_B6 1976 80#define NOTE_C7 2093 81#define NOTE_CS7 2217 82#define NOTE_D7 2349 83#define NOTE_DS7 2489 84#define NOTE_E7 2637 85#define NOTE_F7 2794 86#define NOTE_FS7 2960 87#define NOTE_G7 3136 88#define NOTE_GS7 3322 89#define NOTE_A7 3520 90#define NOTE_AS7 3729 91#define NOTE_B7 3951 92#define NOTE_C8 4186 93#define NOTE_CS8 4435 94#define NOTE_D8 4699 95#define NOTE_DS8 4978 96
Downloadable files
Pinout schematics
Pinout schematics
Pinout schematics
Pinout schematics
Comments
Only logged in users can leave comments
462800
a year ago
Something goes wrong on this part of the code: if (num == 0) TV.bitmap (pos,88,nu0); if (num == 1) TV.bitmap (pos,88,nu1); if (num == 2) TV.bitmap (pos,88,nu2); if (num == 3) TV.bitmap (pos,88,nu3); if (num == 4) TV.bitmap (pos,88,nu4); if (num == 5) TV.bitmap (pos,88,nu5); if (num == 6) TV.bitmap (pos,88,nu6); if (num == 7) TV.bitmap (pos,88,nu7); if (num == 8) TV.bitmap (pos,88,nu8); if (num == 9) TV.bitmap (pos,88,nu9); It gives a error code and I don't know what the problem is, it give's the error code: Compilation error: 'nu0' was not declared in this scope I hope there is a solution for this.
giobbino
a year ago
**** READ ME IF YOU EXPERIENCED A PROBLEM WITH FONTALL.H MISSING! **** Some users told me about this problem while compiling. If you have the same issue, please follow these instrucions. - Go to the https://github.com/Avamander/arduino-tvout page - download the libraries (button code -> download ZIP) - open the zip, extract the two folders TVout and TVoutfonts - go in the Arduino libraries folder (it should be in your Documents folder -> Arduino -> libraries) - copy the two folders (TVout and TVoutfonts) in the libraries folder mentioned above Should be ok now!
desertwalker66
a year ago
Thanks for this. I appreciate this
giobbino
6 Followers
•6 Projects
4
4
Arduino Nano Pac Man | Arduino Project Hub
462800
a year ago
Another thing about that, all of them get red so none of those work.