Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 1 for x=0 to 15
- 2 vol(x,0)
- 3 next x
- 4 for x=0 to 127
- 5 spena(x,0)
- 6 next x
- 7 gmode(15)
- 8 cursoff()
- 10 mload("pactile.mem",0x8000,8192)
- 11 mload("pacsprites.mem",0xC000,16384)
- 20 dim mx(6);dim my(6);dim mmode(6)
- 21 dim mdir(6);dim mcango(6);dim mcangop(6)
- 22 dim mmvcnt(6);dim mspeed(6);dim moncent(6)
- 23 dim mtargx(6);dim mtargy(6);dim moffy(6)
- 24 dim lastdir(6)
- 31 for x = 0 to 5
- 32 mx(x)=0;my(x)=0
- 33 mmode(x)=0;mdir(x)=0
- 34 mcango(x)=0;mcangop(x)=0
- 35 mmvcnt(x)=0;mspeed(x)=256
- 36 moncent(x)=0;lastdir(x)=0
- 37 mtargx(x)=0;mtargy(x)=0
- 38 moffy(x)=0
- 39 next x
- 40 seed=12345;lives=3;score=0;lastbonus=0;level=1
- 41 for x = 10 to 19
- 42 spena(x,0);spimg(x,2,1);spflr(x,0)
- 43 sptcolor(x,0);splayer(x,3)
- 44 spmove(x,(x-10)*16,224)
- 45 next x
- 46 for x = 0 to 6
- 47 spena(x+20,0);spimg(x+20,16,1);spflr(x+20,0)
- 48 sptcolor(x+20,0);splayer(x+20,3);spmove(x+20,(19-x)*16,224)
- 49 next x
- 50 gosub 20000
- 52 gosub 2000
- 90 spena(4,0);REM NEW SCREEN STARTS HERE
- 100 if level<8 then lghosttime=180-15*level else lghosttime=60
- 101 if level<8 then rghosttime=330-30*level else rghosttime=90
- 110 fleetime=0;chasetime=0;disptime=420
- 200 eyes=0;eatencount=0;pacanim=0;pacstage=0
- 201 for x = 17 to 22
- 202 tset(0,x,18,0,0,0x08,0x00)
- 203 next x
- 205 spflr(5,0);sptcolor(5,0);splayer(5,3);spena(5,0)
- 206 spimg(4,0,1);spflr(4,0);sptcolor(4,0);splayer(4,3);spena(4,1)
- 207 mx(4)=152
- 210 if tget(0,19,23)=10 then my(4)=180;goto 220;REM CHOOSE PLAYER START LOCATION
- 211 if tget(0,19,26)=10 then my(4)=204;goto 220
- 212 if tget(0,19,9)=10 then my(4)=68;goto 220
- 213 if tget(0,19,7)=10 then my(4)=52;goto 220
- 215 if tget(0,19,6)=10 then my(4)=44;goto 220
- 216 if tget(0,19,4)=10 then my(4)=28;goto 220
- 220 my(4)=140;mdir(4)=0
- 221 mmode(4)=1
- 230 spmove(4,mx(4),my(4))
- 240 wave(2,1,128);vol(2,32);REM SET UP VOICES
- 241 wave(3,1,128);vol(3,0);note(3,2.667)
- 242 amod(2,1,3,1502);note(2,675)
- 243 wave(4,2,128);vol(4,128)
- 244 wave(5,1,128);vol(5,0);note(5,3.703)
- 245 amod(4,1,5,2185)
- 246 adsr(4,250,0,255,200)
- 250 gosub 3250
- 300 vsync();REM GAME LOOP STARTS HERE
- 301 gosub 19000
- 302 gosub 2400
- 309 if mmode(4)!=1 then goto 330
- 310 goaldir=0;REM PLAYER INPUT
- 313 if keypress("w") then goaldir=1
- 314 if keypress("d") then goaldir=2
- 315 if keypress("s") then goaldir=4
- 316 if keypress("a") then goaldir=8
- 317 if my(4)=116 and (mx(x)<=28 or mx(x)>276) then goaldir=(goaldir&10)
- 318 goaldir=(goaldir&mcango(4))
- 319 if goaldir!=0x00 then mdir(4)=goaldir
- 320 if (mdir(4)&0x01)!=0x00 then mdir(4)=1;REM NO DIAGONAL MOVEMENT ALLOWED
- 321 if (mdir(4)&0x02)!=0x00 then mdir(4)=2
- 322 if (mdir(4)&0x04)!=0x00 then mdir(4)=4
- 323 if (mdir(4)&0x08)!=0x00 then mdir(4)=8
- 325 if moncent(4)=0 then goto 330
- 326 xt=floor((mx(4)+4)/8);REM CHECK IF PLAYER ATE A DOT
- 327 yt=floor((my(4)+4)/8)
- 328 if tget(0,xt,yt)=10 then tset(0,xt,yt,0,0,0x08,0x00);dots=dots-1;note(4,700,0.085);score=score+10
- 329 if tget(0,xt,yt)=12 then gosub 1100
- 330 if mdir(4)=0 then goto 350
- 331 pacanim=pacanim+64;REM PAC-MAN SPRITE ANIMATION
- 332 if pacanim<256 then goto 340
- 333 pacanim=pacanim-256
- 334 pacstage=pacstage+1
- 335 if pacstage>3 then pacstage=0
- 336 if pacstage=0 then spimg(4,0,1);goto 340
- 337 if pacstage=1 then spimg(4,1,1);goto 340
- 338 if pacstage=2 then spimg(4,2,1);goto 340
- 339 spimg(4,1,1)
- 340 if mdir(4)=0x01 then spflr(4,6);goto 350
- 341 if mdir(4)=0x02 then spflr(4,0);goto 350
- 342 if mdir(4)=0x04 then spflr(4,4);goto 350
- 343 if mdir(4)=0x08 then spflr(4,1);goto 350
- 350 if eyes>0 then wave(3,1,0);note(2,1500);note(3,4);amod(2,1,3,5464);goto 360;REM GHOST EYES SOUND
- 351 if fleetime>0 then wave(3,1,255);note(2,1250);note(3,7.692);amod(2,1,3,5738);goto 360;REM FLEEING GHOST SOUND
- 352 wave(3,1,128)
- 353 if dots<50 then note(2,1225);note(3,3.636);amod(2,1,3,2049);goto 360;REM FASTEST SIREN
- 354 if dots<100 then note(2,937.5);note(3,3.077);amod(2,1,3,1980);goto 360;REM FASTER SIREN
- 355 if dots<200 then note(2,800);note(3,2.857);amod(2,1,3,1639);goto 360;REM FAST SIREN
- 356 note(2,675);note(3,2.667);amod(2,1,3,1502);REM NORMAL SIREN
- 360 if lghosttime>0 then lghosttime=lghosttime-1
- 361 if rghosttime>0 then rghosttime=rghosttime-1
- 362 if fleetime>0 then fleetime=fleetime-1
- 363 if disptime>0 then goto 400 else goto 500
- 400 disptime=disptime-1;REM GHOST SCATTER MODE
- 401 if disptime=0 then chasetime=1200
- 402 if mmode(0)=4 then mtargx(0)=20;mtargy(0)=44
- 403 if mmode(1)=4 then mtargx(1)=284;mtargy(1)=44
- 404 if mmode(2)=4 then mtargx(2)=20;mtargy(2)=188
- 405 if mmode(3)=4 then mtargx(3)=284;mtargy(3)=188
- 409 goto 520
- 500 if chasetime>0 then chasetime=chasetime-1 else disptime=420;REM GHOST CHASE MODE
- 501 if mmode(0)=4 then mtargx(0)=mx(4);mtargy(0)=my(4)
- 502 if mmode(2)!=4 then goto 510
- 503 if lastdir(4)=1 then mtargx(2)=mx(4);mtargy(2)=my(4)-16;goto 510
- 504 if lastdir(4)=2 then mtargx(2)=mx(4)+16;mtargy(2)=my(4);goto 510
- 505 if lastdir(4)=4 then mtargx(2)=mx(4);mtargy(2)=my(4)+16;goto 510
- 506 if lastdir(4)=8 then mtargx(2)=mx(4)-16;mtargy(2)=my(4);goto 510
- 507 mtargx(2)=mx(4);mtargy(2)=my(4)
- 510 if mmode(1)=4 then mtargx(1)=mtargx(2)+(mtargx(2)-mx(0));mtargy(1)=mtargy(2)+(mtargy(2)-my(0))
- 511 if mmode(3)!=4 then goto 520
- 512 if abs(mx(4)-mx(3))+abs(my(4)-my(3))<64 then goto 405
- 513 mtargx(3)=mx(4);mtargy(3)=my(4)
- 520 eyes=0;playerhit=0
- 521 for x = 0 to 3;REM GHOST SPEED AND HIT DETECTION
- 522 if mmode(x)=6 then mspeed(x)=512;eyes=eyes+1;mtargx(x)=152;mtargy(x)=116;goto 550
- 523 if mmode(x)=5 then mspeed(x)=128;goto 525
- 524 if level<8 then mspeed(x)=256+8*level else mspeed(x)=320
- 525 if my(x)=116 and (mx(x)<=28 or mx(x)>276) then mspeed(x)=floor(mspeed(x)/2)
- 526 if abs(mx(x)-mx(4))>4 or abs(my(x)-my(4))>4 then goto 550
- 527 if mmode(x)<5 then playerhit=1;goto 550
- 528 if mmode(x)>5 then goto 550
- 530 spanim(x,0,0);REM GHOST GOT EATEN
- 531 if eatencount=3 then score=score+1600;spimg(x,63,1);goto 535
- 532 if eatencount=2 then score=score+800;spimg(x,23,1);eatencount=3;goto 535
- 533 if eatencount=1 then score=score+400;spimg(x,15,1);eatencount=2;goto 535
- 534 if eatencount=0 then score=score+200;spimg(x,14,1);eatencount=1
- 535 wave(6,1,255);vol(6,0);wave(7,2,128);vol(7,255);amod(7,1,6,4098);REM RISING WHOOP
- 536 note(6,2,0.5);note(7,750,0.5)
- 537 sleep(500)
- 538 mmode(x)=6
- 550 next x
- 555 if playerhit then goto 2650
- 560 if mmode(5)>0 and bonusstage<3 and abs(mx(5)-mx(4))<=4 and abs(my(5)-my(4))<=4 then gosub 3500
- 600 scorecopy=score;REM DISPLAY SCORE
- 601 x=22
- 610 c=48+(scorecopy%10)
- 611 drawchar(x,2,c,15,0)
- 612 scorecopy=floor(scorecopy/10);x=x-1
- 613 if scorecopy>0 then goto 610
- 614 drawchar(x,2," ",15,0)
- 615 x=x-1
- 616 if x>10 then goto 614
- 700 bonus=floor(score/10000);REM BONUS LIFE EVERY 10000 POINTS
- 701 if bonus<=lastbonus then goto 720
- 702 lives=lives+1;lastbonus=bonus
- 703 wave(9,1,0);vol(9,0);wave(10,1,0);vol(10,100);amod(10,0,9,32767)
- 704 note(9,5.4945,1.82);note(10,300,1.82);REM CLANG CLANG CLANG
- 705 gosub 3250
- 720 if bonustimer=0 then goto 750
- 721 bonustimer=bonustimer-1
- 722 if bonustimer>0 then goto 750
- 723 on bonusstage goto 725,730,800,740,800
- 725 mmode(5)=4;mx(5)=-15;my(5)=116;mdir(5)=2;REM BONUS ITEM ENTERS THE SCREEN
- 726 mtargx(5)=152;mtargy(5)=116;spmove(5,-15,116)
- 727 mspeed(5)=128;bonusstage=1;bonustimer=1200
- 728 goto 750
- 730 mtargx(5)=336;mtargy(5)=116;REM BONUS ITEM HEADS TOWARDS EXIT
- 731 bonusstage=2
- 732 goto 750
- 740 mmode(5)=0;mx(5)=336;my(5)=116;REM ERASE BONUS SCORE INDICATION
- 750 if mmode(5)=0 or bonusstage=3 then goto 800
- 751 bonusanim=bonusanim+1;REM BONUS ITEM BOUNCE ANIMATION
- 752 if bonusanim>=15 then bonusanim=0;wave(8,3,128);vol(8,64);note(8,50,.085)
- 753 if bonusanim<1 then moffy(5)=0;goto 800
- 754 if bonusanim<3 or bonusanim>12 then moffy(5)=1;goto 800
- 755 moffy(5)=2
- 800 if dots>0 then goto 300
- 801 vol(2,0);REM LEVEL COMPLETED
- 802 spimg(4,0,1)
- 803 mdir(4)=0
- 804 for x = 0 to 3
- 805 spena(x,0)
- 806 next x
- 808 sleep(250)
- 810 for x = 1 to 4
- 811 setcolor(20,200,200,200);REM FLASH MAZE
- 812 sleep(183)
- 813 setcolor(20,0,0,215)
- 814 sleep(183)
- 815 next x
- 818 sleep(250)
- 850 level=level+1
- 901 gosub 40000
- 902 gosub 20000
- 903 goto 90
- 1100 tset(0,xt,yt,0,0,0x08,0x00);REM PLAYER ATE A POWER PELLET
- 1101 if level<8 then fleetime=660-60*level else fleetime=180
- 1102 for x = 0 to 3
- 1103 if mmode(x)=4 then mmode(x)=5;mdir(x)=0;lastdir(x)=0;REM GHOSTS SET TO FLEE
- 1104 next x
- 1105 eatencount=0
- 1110 return
- 2000 vol(255);REM NEW GAME MUSIC
- 2010 wave(0,2,128)
- 2011 vol(0,255)
- 2012 adsr(0,250,0,255,200)
- 2013 wave(1,2,128)
- 2014 vol(1,127)
- 2015 adsr(1,200,0,255,100)
- 2040 note(0,"B4",0.0625);note(1,"E3",0.1875);sleep(125)
- 2041 note(0,"B5",0.0625);sleep(125)
- 2043 note(0,"F#5",0.0625);sleep(125)
- 2044 note(0,"D#5",0.0625);note(1,"B3",0.125);sleep(125)
- 2045 note(0,"B5",0.0625);note(1,"E3",0.1875);sleep(63)
- 2046 note(0,"F#5",0.0625);sleep(188)
- 2047 note(0,"D#5",0.125);sleep(125)
- 2048 note(1,"B3",0.125);sleep(125)
- 2050 note(0,"C5",0.0625);note(1,"F3",0.1875);sleep(125)
- 2051 note(0,"C6",0.0625);sleep(125)
- 2053 note(0,"G5",0.0625);sleep(125)
- 2054 note(0,"E5",0.0625);note(1,"A3",0.125);sleep(125)
- 2055 note(0,"C6",0.0625);note(1,"F3",0.1875);sleep(63)
- 2056 note(0,"G5",0.0625);sleep(188)
- 2057 note(0,"E5",0.125);sleep(125)
- 2058 note(1,"A3",0.125);sleep(125)
- 2060 note(0,"B4",0.0625);note(1,"E3",0.1875);sleep(125)
- 2061 note(0,"B5",0.0625);sleep(125)
- 2063 note(0,"F#5",0.0625);sleep(125)
- 2064 note(0,"D#5",0.0625);note(1,"B3",0.125);sleep(125)
- 2065 note(0,"B5",0.0625);note(1,"E3",0.1875);sleep(63)
- 2066 note(0,"F#5",0.0625);sleep(188)
- 2067 note(0,"D#5",0.125);sleep(125)
- 2068 note(1,"B3",0.125);sleep(125)
- 2070 note(0,"D#4",0.0625);note(1,"F#3",0.1875);sleep(63)
- 2071 note(0,"E5",0.0625);sleep(63)
- 2072 note(0,"F5",0.0625);sleep(125)
- 2073 note(0,"F5",0.0625);note(1,"G#3",0.1875);sleep(63)
- 2074 note(0,"F#5",0.0625);sleep(63)
- 2075 note(0,"G5",0.0625);sleep(125)
- 2076 note(0,"G5",0.0625);note(1,"A#3",0.1875);sleep(63)
- 2077 note(0,"G#5",0.0625);sleep(63)
- 2078 note(0,"A5",0.0625);sleep(125)
- 2079 note(0,"B5",0.125);note(1,"B3",0.1875);sleep(250)
- 2080 return
- 2400 for x = 0 to 3;REM GHOST SPRITE DISPLAY LOGIC
- 2401 if mmode(x)=0 then spena(x,0);goto 2440
- 2402 spena(x,1);splayer(x,3)
- 2403 if mmode(x)<5 then goto 2410
- 2404 if mmode(x)=5 then goto 2420
- 2405 if mmode(x)=6 then goto 2430
- 2406 goto 2440
- 2410 if mdir(x)=1 then spimg(x,34+x*8,1);spanim(x,1,3);spflr(x,0);goto 2440;REM NORMAL GHOST
- 2411 if mdir(x)=2 then spimg(x,32+x*8,1);spanim(x,1,3);spflr(x,0);goto 2440
- 2412 if mdir(x)=4 then spimg(x,36+x*8,1);spanim(x,1,3);spflr(x,0);goto 2440
- 2413 if mdir(x)=8 then spimg(x,32+x*8,1);spanim(x,1,3);spflr(x,1);goto 2440
- 2414 goto 2440
- 2420 if fleetime=0 then mmode(x)=4;goto 2410;REM FLEEING GHOST
- 2421 if fleetime>120 then goto 2425
- 2423 spimg(x,24,1);spanim(x,2,3);spflr(x,0);goto 2440
- 2425 spimg(x,24,1);spanim(x,1,3);spflr(x,0);goto 2440
- 2430 if mdir(x)=1 then spimg(x,30,1);spanim(x,0,0);spflr(x,0);goto 2440;REM EYES
- 2431 if mdir(x)=2 then spimg(x,28,1);spanim(x,0,0);spflr(x,0);goto 2440
- 2432 if mdir(x)=4 then spimg(x,31,1);spanim(x,0,0);spflr(x,0);goto 2440
- 2433 if mdir(x)=8 then spimg(x,29,1);spanim(x,0,0);spflr(x,0)
- 2440 next x
- 2441 return
- 2500 on mmode(x) goto 2590,2560,2570,2575,2505,2580,2585,2590;REM GHOST AND BONUS ITEM MOVEMENT
- 2505 if mcangop(x)=mcango(x) and mdir(x)!=0 then goto 2590
- 2506 deltax=mtargx(x)-mx(x);REM SEEK TARGET LOCATION
- 2507 deltay=mtargy(x)-my(x)
- 2508 abdx=abs(deltax)
- 2509 abdy=abs(deltay)
- 2510 if deltay<0 and abdy>=abdx then goto 2520;REM WANTS TO MOVE UP
- 2511 if deltay>0 and abdy>=abdx then goto 2530;REM WANTS TO MOVE DOWN
- 2512 if deltax<0 and abdy<=abdx then goto 2540;REM WANTS TO MOVE LEFT
- 2513 if deltax>0 and abdy<=abdx then goto 2550;REM WANTS TO MOVE RIGHT
- 2514 goto 2590
- 2520 if lastdir(x)!=4 and (mcango(x)&0x01)!=0x00 then mdir(x)=1;goto 2590
- 2521 if deltax>=0 and lastdir(x)!=8 and (mcango(x)&0x02)!=0x00 then mdir(x)=2;goto 2590
- 2522 if deltax<=0 and lastdir(x)!=2 and (mcango(x)&0x08)!=0x00 then mdir(x)=8;goto 2590
- 2523 if lastdir(x)!=8 and (mcango(x)&0x02)!=0x00 then mdir(x)=2;goto 2590
- 2524 if lastdir(x)!=2 and (mcango(x)&0x08)!=0x00 then mdir(x)=8;goto 2590
- 2525 if (mcango(x)&0x04)!=0x00 then mdir(x)=4;goto 2590
- 2526 goto 2590
- 2530 if lastdir(x)!=1 and (mcango(x)&0x04)!=0x00 then mdir(x)=4;goto 2590
- 2531 if deltax>=0 and lastdir(x)!=8 and (mcango(x)&0x02)!=0x00 then mdir(x)=2;goto 2590
- 2532 if deltax<=0 and lastdir(x)!=2 and (mcango(x)&0x08)!=0x00 then mdir(x)=8;goto 2590
- 2533 if lastdir(x)!=8 and (mcango(x)&0x02)!=0x00 then mdir(x)=2;goto 2590
- 2534 if lastdir(x)!=2 and (mcango(x)&0x08)!=0x00 then mdir(x)=8;goto 2590
- 2535 if (mcango(x)&0x01)!=0x00 then mdir(x)=1;goto 2590
- 2536 goto 2590
- 2540 if lastdir(x)!=2 and (mcango(x)&0x08)!=0x00 then mdir(x)=8;goto 2590
- 2541 if deltay>=0 and lastdir(x)!=1 and (mcango(x)&0x04)!=0x00 then mdir(x)=4;goto 2590
- 2542 if deltay<=0 and lastdir(x)!=4 and (mcango(x)&0x01)!=0x00 then mdir(x)=1;goto 2590
- 2543 if lastdir(x)!=1 and (mcango(x)&0x04)!=0x00 then mdir(x)=4;goto 2590
- 2544 if lastdir(x)!=4 and (mcango(x)&0x01)!=0x00 then mdir(x)=1;goto 2590
- 2545 if (mcango(x)&0x02)!=0x00 then mdir(x)=2;goto 2590
- 2546 goto 2590
- 2550 if lastdir(x)!=8 and (mcango(x)&0x02)!=0x00 then mdir(x)=2;goto 2590
- 2551 if deltay>=0 and lastdir(x)!=1 and (mcango(x)&0x04)!=0x00 then mdir(x)=4;goto 2590
- 2552 if deltay<=0 and lastdir(x)!=4 and (mcango(x)&0x01)!=0x00 then mdir(x)=1;goto 2590
- 2553 if lastdir(x)!=1 and (mcango(x)&0x04)!=0x00 then mdir(x)=4;goto 2590
- 2554 if lastdir(x)!=4 and (mcango(x)&0x01)!=0x00 then mdir(x)=1;goto 2590
- 2555 if (mcango(x)&0x08)!=0x00 then mdir(x)=8;goto 2590
- 2556 goto 2590
- 2560 if mx(x)<152 and lghosttime=0 and my(x)=116 then mdir(x)=2;mmode(x)=2;goto 2590;REM GHOST HOUSE SIDES
- 2561 if mx(x)>152 and rghosttime=0 and my(x)=116 then mdir(x)=8;mmode(x)=2;goto 2590
- 2562 if mdir(x)!=0 then goto 2590
- 2563 if lastdir(x)=1 then mdir(x)=4;goto 2590
- 2564 if lastdir(x)=2 then mdir(x)=8;goto 2590
- 2565 if lastdir(x)=4 then mdir(x)=1;goto 2590
- 2566 if lastdir(x)=8 then mdir(x)=2;goto 2590
- 2567 goto 2590
- 2570 if mx(x)=152 then mdir(x)=1;mmode(x)=3;REM GHOST HOUSE MOVE TO CENTER
- 2571 goto 2590
- 2575 if my(x)!=92 then goto 2562;REM GHOST HOUSE EXIT CENTER
- 2576 mmode(x)=4
- 2577 if mtargx(x)<mx(x) then mdir(x)=8 else mdir(x)=2
- 2578 goto 2590
- 2580 deltax=mx(x)-mx(4);REM GHOSTS FLEE THE PLAYER
- 2581 deltay=my(x)-my(4)
- 2582 goto 2508
- 2585 if mx(x)!=152 then goto 2505;REM EYES RETURN TO THE GHOST HOUSE
- 2586 if my(x)>=92 and my(x)<116 then mdir(x)=4;goto 2590
- 2587 if my(x)>=116 and my(x)<124 then mdir(x)=1;mmode(x)=3;goto 2590
- 2588 goto 2505
- 2590 return
- 2650 vol(2,0);REM PLAYER CAUGHT BY GHOST ANIMATION
- 2652 for x = 0 to 3
- 2653 spena(x,0)
- 2654 next x
- 2655 spflr(4,0);spanim(4,0,0);spimg(4,0,1)
- 2656 note(3,0,0);note(2,0,0);wave(2,1,255);wave(3,1,128);amod(2,1,3,273)
- 2657 sleep(50)
- 2658 note(3,5.4)
- 2659 sleep(92.5);vol(2,127)
- 2670 note(2,700);sleep(92.5);spimg(4,0,1);sleep(92.5);spimg(4,3,1)
- 2671 note(2,650);sleep(92.5);spimg(4,4,1);sleep(92.5);spimg(4,5,1)
- 2672 note(2,600);sleep(92.5);spimg(4,6,1);sleep(92.5);spimg(4,7,1)
- 2673 note(2,550);sleep(92.5);spimg(4,8,1);sleep(92.5);spimg(4,9,1)
- 2674 note(2,500);sleep(92.5);spimg(4,10,1);sleep(92.5);spimg(4,11,1)
- 2675 note(2,450);sleep(92.5);spimg(4,12,1);sleep(92.5);spimg(4,13,1)
- 2677 note(3,0,0);note(2,0,0);wave(2,2,0);wave(3,1,255)
- 2678 sleep(50)
- 2679 note(3,5.4);note(2,1100,0.370);amod(2,1,3,6011);vol(2,93)
- 2680 sleep(370)
- 2681 vol(2,0);spena(4,0)
- 2682 lives=lives-1
- 2683 if lives<0 then goto 4000
- 2684 gosub 3000
- 2685 gosub 3100
- 2686 gosub 3250
- 2687 sleep(1000)
- 2688 goto 90
- 3000 mmode(0)=4;mdir(0)=8;mx(0)=152;my(0)=92;REM GHOST SETUP
- 3001 mmode(1)=3;mdir(1)=4;mx(1)=152;my(1)=116
- 3002 mmode(2)=1;mdir(2)=1;mx(2)=136;my(2)=116
- 3003 mmode(3)=1;mdir(3)=1;mx(3)=168;my(3)=116
- 3004 for x = 0 to 3
- 3005 spmove(x,mx(x),my(x))
- 3006 next x
- 3007 return
- 3100 tset(0,17,18,16,0,0x08,0x00);REM DRAW READY MESSAGE
- 3101 tset(0,18,18,17,0,0x08,0x00)
- 3102 tset(0,19,18,18,0,0x08,0x00)
- 3103 tset(0,20,18,19,0,0x08,0x00)
- 3104 tset(0,21,18,20,0,0x08,0x00)
- 3105 tset(0,22,18,21,0,0x08,0x00)
- 3110 for x = 0 to 6;REM DRAW LEVEL INDICATION
- 3111 if level>x then spena(x+20,1) else spena(x+20,0)
- 3112 if level<8 then spimg(x+20,16+x,1);goto 3115
- 3113 if x+level<14 then spimg(x+20,9+x+level,1);goto 3115
- 3114 spimg(x+20,22,1)
- 3115 next x
- 3116 if level<8 then spimg(5,level+15,1) else spimg(5,22,1)
- 3120 return
- 3250 for x = 0 to 9;REM DRAW LIVES
- 3251 if x<lives then spena(x+10,1) else spena(x+10,0)
- 3252 next x
- 3253 return
- 3500 mdir(5)=0;mtargx(5)=mx(5);mtargy(5)=my(5);REM PLAYER ATE THE BONUS ITEM
- 3501 bonustimer=60;bonusanim=0;moffy(5)=0;bonusstage=3
- 3502 on level goto 3503,3503,3504,3505,3506,3507,3508,3509
- 3503 spimg(5,38,1);score=score+100;goto 3510
- 3504 spimg(5,39,1);score=score+200;goto 3510
- 3505 spimg(5,46,1);score=score+500;goto 3510
- 3506 spimg(5,47,1);score=score+700;goto 3510
- 3507 spimg(5,54,1);score=score+1000;goto 3510
- 3508 spimg(5,55,1);score=score+2000;goto 3510
- 3509 spimg(5,62,1);score=score+5000;goto 3510
- 3510 wave(6,1,255);vol(6,0);wave(7,2,128);vol(7,255);amod(7,1,6,4098);REM RISING WHOOP
- 3511 note(6,2,0.5);note(7,750,0.5)
- 3512 return
- 4000 drawchar(15,15,"GAME OVER",9,0);REM GAME OVER
- 4001 for x = 15 to 25
- 4002 tset(0,x,15,0,0,0,0)
- 4003 next x
- 4004 goto 4004
- 19000 for x = 0 to 5;REM SPRITE MOVEMENT AND MAZE COLLISION DETECTION
- 19001 if mmode(x)=0 then spena(x,0);goto 19099
- 19002 spena(x,1)
- 19003 mmvcnt(x)=mmvcnt(x)+mspeed(x)
- 19004 mcangop(x)=mcango(x)
- 19005 if mmvcnt(x)<256 then goto 19099
- 19007 mmvcnt(x)=mmvcnt(x)-256
- 19008 if mdir(x)=0 then goto 19020
- 19009 if (mdir(x)&0x01)!=0x00 then my(x)=my(x)-1
- 19010 if (mdir(x)&0x02)!=0x00 then mx(x)=mx(x)+1
- 19011 if (mdir(x)&0x04)!=0x00 then my(x)=my(x)+1
- 19012 if (mdir(x)&0x08)!=0x00 then mx(x)=mx(x)-1
- 19013 if mx(x)<-16 then mx(x)=mx(x)+336;REM SCREEN WRAP
- 19014 if my(x)<-16 then my(x)=my(x)+256
- 19015 if mx(x)>=320 and x=5 then mmode(x)=0;goto 19099;REM BONUS ITEM DOESN'T WRAP
- 19016 if mx(x)>=320 then mx(x)=mx(x)-336
- 19017 if my(x)>=240 then my(x)=my(x)-256
- 19019 spmove(x,mx(x),my(x)-moffy(x))
- 19020 mcango(x)=0
- 19021 xt=floor((mx(x)+4)/8);REM CHECK IF WE'RE CENTERED ON A TILE
- 19022 xo=(mx(x)-xt*8)+4
- 19023 yt=floor((my(x)+4)/8)
- 19024 yo=(my(x)-yt*8)+4
- 19025 moncent(x)=0
- 19026 if x<4 and mmode(x)<4 then goto 19080
- 19030 if xo!=0 then mcango(x)=mcango(x)+10
- 19031 if yo!=0 then mcango(x)=mcango(x)+5
- 19032 if xo!=0 or yo!=0 then goto 19060
- 19040 moncent(x)=1
- 19041 tcheck=tget(0,xt,yt-1);REM CHECK ADJACENT TILES FOR WALLS
- 19042 if tcheck=0 or tcheck=10 or tcheck=12 then mcango(x)=mcango(x)+1
- 19045 tcheck=tget(0,xt+1,yt)
- 19046 if tcheck=0 or tcheck=10 or tcheck=12 then mcango(x)=mcango(x)+2
- 19050 tcheck=tget(0,xt,yt+1)
- 19051 if tcheck=0 or tcheck=10 or tcheck=12 then mcango(x)=mcango(x)+4
- 19055 tcheck=tget(0,xt-1,yt)
- 19056 if tcheck=0 or tcheck=10 or tcheck=12 then mcango(x)=mcango(x)+8
- 19060 if my(x)=116 and (mx(x)<=28 or mx(x)>276) then mcango(x)=(mcango(x)&10)
- 19061 mdir(x)=(mdir(x)&mcango(x))
- 19062 if (mdir(x)&0x01)!=0 then mdir(x)=1;REM NO DIAGONAL MOVEMENT ALLOWED
- 19063 if (mdir(x)&0x02)!=0 then mdir(x)=2
- 19064 if (mdir(x)&0x04)!=0 then mdir(x)=4
- 19065 if (mdir(x)&0x08)!=0 then mdir(x)=8
- 19066 if mdir(x)!=0 then lastdir(x)=mdir(x)
- 19068 if x!=4 then gosub 2500
- 19070 goto 19005
- 19080 if my(x)>112 or (my(x)>92 and mmode(x)=3) then mcango(x)=mcango(x)+1;REM GHOST HOUSE MOVEMENT
- 19081 if my(x)<120 then mcango(x)=mcango(x)+4
- 19082 if mx(x)<152 then mcango(x)=mcango(x)+2
- 19083 if mx(x)>152 then mcango(x)=mcango(x)+8
- 19085 goto 19060
- 19099 next x
- 19100 return
- 20000 gmode(0);REM DRAW NEW MAZE SCREEN
- 20001 for x = 0 to 39
- 20002 for y = 0 to 29
- 20003 drawchar(x,y," ",15,0)
- 20004 next y
- 20005 next x
- 20006 drawchar(18,1,"SCORE",15,0)
- 20009 mload("pacscreen.mem",0x4000,8192)
- 20010 if (seed&0x01)=0x00 then goto 20015;REM PLACE DOTS PROCEDURALLY BASED ON SEED
- 20011 tset(0,5,24,10,0,0x08,0);tset(0,5,25,10,0,0x08,0)
- 20012 tset(0,9,24,10,0,0x08,0);tset(0,9,25,10,0,0x08,0)
- 20013 goto 20020
- 20015 tset(0,7,24,10,0,0x08,0);tset(0,7,25,10,0,0x08,0)
- 20020 if (seed&0x06)=0x00 then goto 20030
- 20021 if (seed&0x06)=0x02 then goto 20035
- 20022 if (seed&0x06)=0x04 then goto 20040
- 20025 tset(0,6,13,10,0,0x08,0);tset(0,7,13,10,0,0x08,0);tset(0,8,13,10,0,0x08,0)
- 20026 tset(0,6,17,10,0,0x08,0);tset(0,7,17,10,0,0x08,0);tset(0,8,17,10,0,0x08,0)
- 20027 goto 20050
- 20030 tset(0,6,15,10,0,0x08,0);tset(0,7,15,10,0,0x08,0);tset(0,8,15,10,0,0x08,0)
- 20031 tset(0,6,20,10,0,0x08,0);tset(0,7,20,10,0,0x08,0);tset(0,8,20,10,0,0x08,0)
- 20032 goto 20050
- 20035 tset(0,6,13,10,0,0x08,0);tset(0,7,13,10,0,0x08,0);tset(0,8,13,10,0,0x08,0)
- 20036 tset(0,6,20,10,0,0x08,0);tset(0,7,20,10,0,0x08,0);tset(0,8,20,10,0,0x08,0)
- 20037 goto 20050
- 20040 tset(0,6,17,10,0,0x08,0);tset(0,7,17,10,0,0x08,0);tset(0,8,17,10,0,0x08,0)
- 20050 if (seed&0x08)=0x00 then goto 20055
- 20051 tset(0,10,23,10,0,0x08,0);tset(0,11,23,10,0,0x08,0)
- 20052 tset(0,13,21,10,0,0x08,0);tset(0,14,21,10,0,0x08,0)
- 20053 goto 20060
- 20055 tset(0,13,23,10,0,0x08,0);tset(0,14,23,10,0,0x08,0)
- 20056 tset(0,10,21,10,0,0x08,0);tset(0,11,21,10,0,0x08,0)
- 20060 tset(0,12,21,10,0,0x08,0);tset(0,12,22,10,0,0x08,0);tset(0,12,23,10,0,0x08,0)
- 20070 if (seed&0x10)=0x00 then goto 20075
- 20071 tset(0,10,18,10,0,0x08,0);tset(0,11,18,10,0,0x08,0)
- 20072 tset(0,13,15,10,0,0x08,0);tset(0,14,15,10,0,0x08,0)
- 20073 goto 20080
- 20075 tset(0,13,18,10,0,0x08,0);tset(0,14,18,10,0,0x08,0)
- 20076 tset(0,10,15,10,0,0x08,0);tset(0,11,15,10,0,0x08,0)
- 20080 tset(0,12,15,10,0,0x08,0);tset(0,12,16,10,0,0x08,0)
- 20081 tset(0,12,17,10,0,0x08,0);tset(0,12,18,10,0,0x08,0)
- 20090 if (seed&0x20)=0x00 then goto 20095
- 20091 tset(0,12,19,10,0,0x08,0);tset(0,12,20,10,0,0x08,0)
- 20095 if (seed&0x40)=0x00 then goto 20100
- 20096 tset(0,12,13,10,0,0x08,0);tset(0,12,14,10,0,0x08,0)
- 20097 tset(0,12,24,10,0,0x08,0);tset(0,12,25,10,0,0x08,0)
- 20100 if (seed&0x80)=0x00 then goto 20105
- 20101 for x = 16 to 23
- 20102 tset(0,x,26,10,0,0x08,0)
- 20103 next x
- 20105 if (seed&0x100)=0x000 then goto 20110
- 20106 for x = 16 to 23
- 20107 tset(0,x,23,10,0,0x08,0)
- 20108 next x
- 20109 goto 20120
- 20110 for x = 16 to 18
- 20111 tset(0,x,23,10,0,0x08,0)
- 20112 tset(0,39-x,23,10,0,0x08,0)
- 20113 next x
- 20114 for y = 19 to 22
- 20115 tset(0,18,y,10,0,0x08,0)
- 20116 tset(0,21,y,10,0,0x08,0)
- 20117 next y
- 20120 if (seed&0x600)=0x000 then goto 20130
- 20121 if (seed&0x600)=0x200 then goto 20135
- 20122 if (seed&0x600)=0x400 then goto 20140
- 20123 tset(0,19,4,0,0,0x08,0);tset(0,20,4,0,0,0x08,0)
- 20124 tset(0,18,5,10,0,0x08,0);tset(0,18,6,10,0,0x08,0);tset(0,19,6,10,0,0x08,0)
- 20127 goto 20150
- 20130 tset(0,18,8,10,0,0x08,0);tset(0,18,7,10,0,0x08,0);tset(0,19,7,10,0,0x08,0)
- 20133 goto 20150
- 20135 tset(0,19,4,0,0,0x08,0);tset(0,20,4,0,0,0x08,0)
- 20136 tset(0,19,6,10,0,0x08,0);tset(0,20,6,10,0,0x08,0)
- 20140 for y = 5 to 8
- 20141 tset(0,18,y,10,0,0x08,0);tset(0,21,y,10,0,0x08,0)
- 20142 next y
- 20150 if (seed&0x800)=0x000 then goto 20155
- 20151 tset(0,13,7,10,0,0x08,0);tset(0,14,7,10,0,0x08,0)
- 20152 tset(0,15,10,10,0,0x08,0);tset(0,15,11,10,0,0x08,0)
- 20153 goto 20160
- 20155 tset(0,13,9,10,0,0x08,0);tset(0,14,9,10,0,0x08,0)
- 20156 tset(0,18,10,10,0,0x08,0);tset(0,18,11,10,0,0x08,0)
- 20160 tset(0,10,10,10,0,0x08,0);tset(0,11,10,10,0,0x08,0)
- 20161 for y = 5 to 9
- 20162 tset(0,15,y,10,0,0x08,0)
- 20163 next y
- 20164 tset(0,16,9,10,0,0x08,0);tset(0,17,9,10,0,0x08,0);tset(0,18,9,10,0,0x08,0)
- 20170 if (seed&0x1000)=0x0000 then goto 20175
- 20171 tset(0,19,9,10,0,0x08,0)
- 20172 goto 20180
- 20175 tset(0,18,10,10,0,0x08,0);tset(0,18,11,10,0,0x08,0)
- 20180 if tget(0,19,7)=10 then tset(0,19,9,0,0,0x08,0);tset(0,20,9,0,0,0x08,0)
- 21000 for x = 0 to 19
- 21010 for y = 3 to 27
- 21020 if tget(0,x,y)=10 then tset(0,39-x,y,10,0,0x08,0);REM MIRROR DOTS
- 21030 next y
- 21040 next x
- 29000 for x = 0 to 39;REM DRAW WALLS BASED ON DOT POSITIONS
- 29001 for y = 3 to 27
- 29002 if tget(0,x,y)!=0 then goto 29050
- 29003 if tget(0,x,y-1)=10 then goto 29020
- 29004 if tget(0,x,y+1)=10 then goto 29030
- 29005 if tget(0,x-1,y)=10 then tset(0,x,y,6,0,0xA8,0);goto 29100
- 29006 if tget(0,x+1,y)=10 then tset(0,x,y,6,0,0x88,0);goto 29100
- 29010 if tget(0,x-1,y-1)=10 then tset(0,x,y,5,0,0x08,0);goto 29100
- 29011 if tget(0,x+1,y-1)=10 then tset(0,x,y,5,0,0x28,0);goto 29100
- 29012 if tget(0,x-1,y+1)=10 then tset(0,x,y,5,0,0x48,0);goto 29100
- 29013 if tget(0,x+1,y+1)=10 then tset(0,x,y,5,0,0x68,0);goto 29100
- 29015 goto 29100
- 29020 if tget(0,x-1,y)=10 then tset(0,x,y,4,0,0x68,0);goto 29100
- 29021 if tget(0,x+1,y)=10 then tset(0,x,y,4,0,0x48,0);goto 29100
- 29022 tset(0,x,y,6,0,0x48,0);goto 29100
- 29030 if tget(0,x-1,y)=10 then tset(0,x,y,4,0,0x28,0);goto 29100
- 29031 if tget(0,x+1,y)=10 then tset(0,x,y,4,0,0x08,0);goto 29100
- 29032 tset(0,x,y,6,0,0x08,0);goto 29100
- 29050 if tget(0,x,y)!=2 then goto 29100
- 29051 if y=3 then goto 29060
- 29052 if y=27 then goto 29070
- 29053 goto 29100
- 29060 if tget(0,x,4)=10 then goto 29070
- 29061 if tget(0,x-1,4)=10 then tset(0,x,3,3,0,0x08,0);goto 29100
- 29062 if tget(0,x+1,4)=10 then tset(0,x,3,3,0,0x28,0);goto 29100
- 29063 if tget(0,x,4)=0 then tset(0,x,3,11,0,0x08,0);goto 29100
- 29064 goto 29100
- 29070 if tget(0,x,26)=10 then goto 29100
- 29071 if tget(0,x-1,26)=10 then tset(0,x,27,3,0,0x48,0);goto 29100
- 29072 if tget(0,x+1,26)=10 then tset(0,x,27,3,0,0x68,0);goto 29100
- 29073 if tget(0,x,26)=0 then tset(0,x,27,11,0,0x48,0);goto 29100
- 29100 next y
- 29110 next x
- 29400 for x = 0 to 4;REM CLEAR DOTS FROM SIDE PASSAGES
- 29410 tset(0,x,15,0,0,0x08,0)
- 29420 tset(0,39-x,15,0,0,0x08,0)
- 29430 next x
- 29500 for x = 13 to 26;REM CLEAR DOTS FROM AROUND GHOST HOUSE
- 29510 for y = 10 to 20
- 29520 if tget(0,x,y)=10 then tset(0,x,y,0,0,0x08,0)
- 29530 next y
- 29540 next x
- 29600 tset(0,1,6,12,0,0x09,0x31);REM PLACE POWER PELLETS
- 29601 tset(0,38,6,12,0,0x09,0x31)
- 29602 tset(0,1,24,12,0,0x09,0x31)
- 29603 tset(0,38,24,12,0,0x09,0x31)
- 29604 for x = 40 to 63
- 29605 tset(0,x,14,2,0,0x08,0x00)
- 29606 tset(0,x,16,2,0,0x18,0x00)
- 29607 next x
- 29700 gosub 3100
- 29800 dots = 0;REM COUNT DOTS TO EAT
- 29801 for x = 0 to 39
- 29802 for y = 0 to 29
- 29803 if tget(0,x,y)=10 then dots=dots+1
- 29804 next y
- 29805 next x
- 29900 gosub 3000
- 29910 bonustimer=1800;bonusstage=0;bonusanim=0
- 29996 vsync()
- 29997 gmode(15)
- 29998 gosub 2400
- 29999 return
- 40000 bit=0;REM PSEUDO-RANDOM NUMBER FOR MAZE GENERATION
- 40001 if (seed&0x0001)!=0 then bit=(bit xor 1)
- 40002 if (seed&0x0004)!=0 then bit=(bit xor 1)
- 40003 if (seed&0x0008)!=0 then bit=(bit xor 1)
- 40004 if (seed&0x0020)!=0 then bit=(bit xor 1)
- 40005 seed=(seed>>1)
- 40006 if bit then seed=seed+0x8000
- 40007 return
Advertisement
Add Comment
Please, Sign In to add comment