home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
001-025
/
apd021
/
pacman.amos
/
pacman.amosSourceCode
Wrap
AMOS Source Code
|
1990-10-26
|
11KB
|
361 lines
Screen Open 0,320,256,16,Lowres
Dim S(6,1),HS(5),NA$(5),B(27,30),G(5,3) : Dir$="apd21:Pacman/"
Global S(),G(),B(),X,Y,TM,SC,LI,TR,LE,JJ,DR,NA$(),HS(),MEG,XG,YG
Randomize Timer
TITLE_PAGE
'
'The following are the actual procedures that do all the work!!!
'
Procedure TITLE_PAGE
Erase 1
Erase 5
Erase 7
Erase 6
If Chip Free>250000
MEG=True
For J=1 To 6 : S(J,0)=J : S(J,1)=8000 : Next J
S(1,1)=12000 : S(2,1)=12000 : S(4,1)=12000 : S(3,1)=6500
Else
MEG=False
For J=1 To 6 : S(J,0)=1 : S(J,1)=(J+5)*1000 : Next J
End If
If MEG
Reserve As Work 1,6000
Reserve As Work 5,70000
Reserve As Work 6,20000
Reserve As Work 7,9000
Load "pacsam.abk"
Load "pacbac.abk",7
Load "gameover.abk",6
Else
Load "pacsam512.abk"
End If
Open In 1,"Pacscore"
For J=1 To 5
Input #1,HS(J),NA$(J)
Next J
Close 1
Paper 0 : Cls : Curs Off : Flash Off : Hide On
Load "pacman.abk"
Do
If MEG
Locate 5,5 : Unpack 7 To 0
Flash 2,"(ff0,10)(dd0,10)(bb0,10)(880,10)(660,10)(440,10)(220,10)"
Flash 10,"(00f,5)(000,5)"
For LOP=1 To 4 : Channel LOP To Bob LOP : Next LOP
Bob 1,96,146,2
Bob 2,96,166,3
Bob 3,50,186,40 : Anim 3,"(40,10)(41,10)l" : Move X 3,"(1,1,80)(1,-1,80)l"
Move On : Anim On
Bob 4,96,208,54
Else
Cls : Locate 0,14 : Centre "Press Fire"
End If
Clear Key : Do : If(Mouse Key=0) and Not(Fire(1)) : Exit : End If : Loop
Do
If(Mouse Key) or(Fire(1)) or(Inkey$<>"") : Exit : End If
Loop
LI=3 : LE=30 : SC=0
BACK_GROUND
SET_UP_VALUES
Do
MOVE_MAN
CHECK_STATUS
If LI<0 : Goto BEGIN : End If
MOVE_THEM
CHECK_POSITION
SCORE
If Mouse Key=2 : End : End If
Loop
BEGIN:
GAME_OVER
Loop
End Proc
Procedure BACK_GROUND
Screen Open 0,320,240,16,Lowres : Paper 0 : Cls
Screen Open 1,320,10,2,Lowres : Paper 0 : Cls : Colour 1,$FFF : Curs Off : Hide On
Print At(6,0);"SCORE:";At(22,0);"LIVES:";
Screen Display 0,128,40,320,250
Screen Display 1,128,280,320,10
Screen 0
Curs Off : Hide On : Sprite Off
Palette $0,$FFF,,$888,,$FC0,$F00,$F0,$FF,$8F,,,,,0,$FFF,,,,,,$FC0
Flash Off
Flash 2,"(ff0,10)(dd0,10)(aa0,10)(880,10)(660,10)(440,10)(220,10)"
Flash 10,"(00f,5)(002,5)"
Restore
For K=1 To 29 : For J=1 To 26
Read B(J,K) : Paste Bob 32+J*8,(K-1)*8,B(J,K)
Next J : Next K : For J=1 To 29 : B(0,J)=10 : B(27,J)=10 : Next J
Screen Copy Physic(0),0,0,320,250 To Logic(0),0,0
Double Buffer : Autoback 1
Data 4,5,5,5,5,5,5,5,5,5,5,5,6,7,5,5,5,5,5,5,5,5,5,5,5,8
Data 9,2,2,2,2,2,2,2,2,2,2,2,10,11,2,2,2,2,2,2,2,2,2,2,2,9
Data 9,2,12,13,13,14,2,12,13,13,14,2,10,11,2,12,13,13,14,2,12,13,13,14,2,9
Data 9,3,11,1,1,10,2,11,1,1,10,2,10,11,2,11,1,1,10,2,11,1,1,10,3,9
Data 9,2,15,16,16,17,2,15,16,16,17,2,18,19,2,15,16,16,17,2,15,16,16,17,2,9
Data 9,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9
Data 9,2,28,16,16,26,2,20,21,2,28,16,16,16,16,26,2,20,21,2,28,16,16,26,2,9
Data 9,2,27,13,13,25,2,10,11,2,27,13,14,12,13,25,2,10,11,2,27,13,13,25,2,9
Data 9,2,2,2,2,2,2,10,11,2,2,2,10,11,2,2,2,10,11,2,2,2,2,2,2,9
Data 22,5,5,5,5,8,2,10,15,16,26,2,10,11,2,28,16,17,11,2,4,5,5,5,5,23
Data 1,1,1,1,1,9,2,10,12,13,25,2,18,19,2,27,13,14,11,2,9,1,1,1,1,1
Data 1,1,1,1,1,9,2,10,11,2,2,2,1,1,2,2,2,10,11,2,9,1,1,1,1,1
Data 5,5,5,5,5,23,2,18,19,2,4,5,24,24,5,8,2,18,19,2,22,5,5,5,5,5
Data 1,1,1,1,1,1,2,2,2,2,9,1,1,1,1,9,2,2,2,2,1,1,1,1,1,1
Data 5,5,5,5,5,8,2,20,21,2,22,5,5,5,5,23,2,20,21,2,4,5,5,5,5,5
Data 1,1,1,1,1,9,2,10,11,2,2,2,2,2,2,2,2,10,11,2,9,1,1,1,1,1
Data 1,1,1,1,1,9,2,10,11,2,28,16,16,16,16,26,2,10,11,2,9,1,1,1,1,1
Data 4,5,5,5,5,23,2,18,19,2,27,13,14,12,13,25,2,18,19,2,22,5,5,5,5,8
Data 9,2,2,2,2,2,2,2,2,2,2,2,10,11,2,2,2,2,2,2,2,2,2,2,2,9
Data 9,2,28,16,16,29,2,28,16,16,26,2,10,11,2,28,16,16,26,2,30,16,16,26,2,9
Data 9,2,27,13,14,11,2,27,13,13,25,2,18,19,2,27,13,13,25,2,10,12,13,25,2,9
Data 9,3,2,2,10,11,2,2,2,2,2,2,2,2,2,2,2,2,2,2,10,11,2,2,3,9
Data 31,16,26,2,10,11,2,20,21,2,28,16,16,16,16,26,2,20,21,2,10,11,2,28,16,32
Data 33,13,25,2,18,19,2,10,11,2,27,13,14,12,13,25,2,10,11,2,18,19,2,27,13,34
Data 9,2,2,2,2,2,2,10,11,2,2,2,10,11,2,2,2,10,11,2,2,2,2,2,2,9
Data 9,2,28,16,16,16,16,17,15,16,26,2,10,11,2,28,16,17,15,16,16,16,16,26,2,9
Data 9,2,27,13,13,13,13,13,13,13,25,2,18,19,2,27,13,13,13,13,13,13,13,25,2,9
Data 9,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,9
Data 22,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,23
End Proc
Procedure SET_UP_VALUES
Make Mask
For J=1 To 6 : Channel J To Bob J : Next J
X=12 : Y=22 : JJ=0
For J=2 To 5
G(J,0)=J : G(J,1)=Rnd(21)+2 : G(J,2)=6 : G(J,3)=Rnd(3)
Next J
Sprite 8,X Hard(0,31+X*8),Y Hard(0,(Y-1)*8-2),35
For J=2 To 5 : G$="("+Str$((J-2)*7+38)+",10)("+Str$((J-2)*7+39)+",10)L"
XG=G(J,1)*8+31 : YG=(G(J,2)-1)*8-2
SP=J : SPN=(J-2)*7+38
Bob SP,XG,YG,SPN : Anim J,G$ : Next J
Anim 8,"(35,5)(36,5)(37,5)(36,5)L" : Anim On
DR=1
End Proc
Procedure MOVE_MAN
If(Jup(1)) and(B(X,Y-1)<4) : DR=3 : Goto ECDIR : End If
If(Jdown(1)) and(B(X,Y+1)<4) : DR=4 : Goto ECDIR : End If
If(Jleft(1)) and(B(X-1,Y)<4) : DR=2 : Goto ECDIR : End If
If(Jright(1)) and(B(X+1,Y)<4) : DR=1 : Goto ECDIR : End If
ECDIR:
If(DR=1) and(B(X+1,Y)<4) : Amal 8,"M 8,0,8" : Amal On 8 : Inc X : End If
If(DR=1) and(X=26) : X=0 : Sprite 8,X Hard(0,31),Y Hard(0,(Y-1)*8-2),35
Goto ECDIR : End If
If(DR=2) and(B(X-1,Y)<4) : Amal 8,"M -8,0,8" : Amal On 8 : Dec X : End If
If(DR=2) and(X=1) : X=26 : Sprite 8,X Hard(0,31+X*8),Y Hard(0,(Y-1)*8-2),42
Goto ECDIR : End If
If(DR=3) and(B(X,Y-1)<4) : Amal 8,"M 0,-8,8" : Amal On 8 : Dec Y : End If
If(DR=4) and(B(X,Y+1)<4) : Amal 8,"M 0,8,8" : Amal On 8 : Inc Y : End If
If DR<>DR1
If DR=1 : Anim 8,"(35,5)(36,5)(37,5)(36,5)L" : Anim On 8 : End If
If DR=2 : Anim 8,"(42,5)(43,5)(44,5)(43,5)L" : Anim On 8 : End If
If DR=4 : Anim 8,"(49,5)(50,5)(51,5)(50,5)L" : Anim On 8 : End If
If DR=3 : Anim 8,"(56,5)(57,5)(58,5)(57,5)L" : Anim On 8 : End If
End If
DR1=DR
End Proc
Procedure MOVE_THEM
For J=2 To 5
If(G(J,0)>0) and(Rnd(50)>LE)
XG=G(J,1) : YG=G(J,2) : DG=G(J,3)
If TM<>0
DG=Rnd(3)
Else
OP=1 : If Rnd(50)>25 : Goto SECOND : End If
FIRST:
If(XG<X) and(B(XG+1,YG)<4) : DG=1 : Goto EXI : End If
If(XG>X) and(B(XG-1,YG)<4) : DG=2 : Goto EXI : End If
Dec OP : If OP=-1 : Goto EXI : End If
SECOND:
If(YG>Y) and(B(XG,YG-1)<4) : DG=3 : Goto EXI : End If
If(YG<Y) and(B(XG,YG+1)<4) : DG=4 : Goto EXI : End If
Dec OP : If OP=0 : Goto FIRST : End If
EXI:
End If
If(DG=1) and(B(XG+1,YG)<4) : Amal J,"M 8,0,8" : Inc XG : End If
If(DG=2) and(B(XG-1,YG)<4) : Amal J,"M -8,0,8" : Dec XG : End If
If(DG=3) and(B(XG,YG-1)<4) : Amal J,"M 0,-8,8" : Dec YG : End If
If(DG=4) and(B(XG,YG+1)<4) : Amal J,"M 0,8,8" : Inc YG : End If
G(J,1)=XG : G(J,2)=YG : G(J,3)=DG
Amal On J
End If
Next J
End Proc
Procedure CHECK_STATUS
If TM<>0 : Dec TM : If TM=0
For J=2 To 5
G$="("+Str$((J-2)*7+38)+",10)("+Str$((J-2)*7+39)+",10)L"
Anim J,G$ : Anim On J
Next J
End If : End If
For J=2 To 5 : If G(J,0)>0
If Bobsprite Col(J,8 To 8)=-1 : G(J,0)=-1 : End If
End If : Next J
If TM>0
For J=2 To 5
If G(J,0)=-1 : G(J,0)=-2 : Add SC,500
Sam Play 6,S(2,0),S(2,1)
GHOST_RET[J] : End If
Next J
End If
For J=2 To 5
If G(J,0)=-2 and(Chanmv(J)=0) and(TM=0)
G(J,0)=J : REPLACE_GHOST[J]
End If
Next J
If TM=0
Z=0
For J=2 To 5
If G(J,0)=-1 : Z=-1 : End If
Next J : If Z : Dec LI
If LI<0 : Pop Proc : Else Boom : BACK_GROUND : SET_UP_VALUES
End If
End If
End If
If(TR=0) and(Rnd(99)>97) : Bob 6,12*8+38,15*8,Rnd(1)+54 : TR=30 : End If
If TR<>0 : Dec TR : If TR=0 : Bob Off 6 : End If
If Spritebob Col(8,6 To 6)=-1 : Add SC,1000
Sam Play 6,S(4,0),S(4,1)
Bob Off 6
TR=0 : End If
End If
End Proc
Procedure CHECK_POSITION
If B(X,Y)=2 : B(X,Y)=1
Volume 9,10 : Play 9,25,0
Autoback 2 : Paste Bob 32+X*8,(Y-1)*8,62 : Add SC,10 : Autoback 1
Add JJ,1
End If
If B(X,Y)=3 : B(X,Y)=1
Sam Play 6,S(1,0),S(1,1)
Add SC,100
Add JJ,1 : For J=2 To 5 : Anim J,"(40,10)(41,10)L" : Anim On J : Next J
TM=25 : Autoback 2 : Paste Bob 32+X*8,(Y-1)*8,62 : Autoback 1
End If
If JJ=260 : LEVEL_INC : End If
End Proc
Procedure GHOST_RET[J]
Anim J,"(47,10)(48,10)L" : Anim On J
DX=142-X Bob(J) : DY=109-Y Bob(J)
G$="A 0,(47,10)(48,10); M"+Str$(DX)+","+Str$(DY)+",50"
Amal J,G$
Amal On J
End Proc
Procedure REPLACE_GHOST[J]
Amal Off J
G(J,1)=12 : G(J,2)=12 : G(J,0)=J
Bob J,G(J,1)*8+31,(G(J,2)-1)*8-2,(J-2)*7+38
Anim J,"("+Str$((J-2)*7+38)+",10)("+Str$((J-2)*7+39)+",10)L"
Anim On J
End Proc
Procedure LEVEL_INC
Add SC,2000
Sam Play 6,S(3,0),S(3,1)
Add LE,-8 : If LE<0 : LE=0 : End If
BACK_GROUND : SET_UP_VALUES
End Proc
Procedure SCORE
Screen 1
Print At(12,0); Using "######";SC;
Print At(28,0); Using "##";LI;
Screen 0
For J=1 To 6
Repeat : Until Not Chanmv(J)
Next J
Repeat : Until Not Chanmv(8)
End Proc
Procedure GAME_OVER
Sam Play 6,S(6,0),S(6,1)
Sprite Off
Screen Close 0
Screen Open 0,320,256,16,Lowres
Paper 0 : Pen 2 : Cls : Flash Off : Curs Off : Hide On
EX=False
For J=5 To 1 Step -1
If SC>HS(J) : EX=True : LE=J : End If
Next J
If EX=False : Goto NBIT : End If
For J=5 To LE Step -1 : HS(J)=HS(J-1) : NA$(J)=NA$(J-1) : Next J
Print At(8,15)+Border$(At(34,17),1)
NAME_GET : NA$(LE)=Param$
HS(LE)=SC
Open Out 1,"Pacscore"
For J=1 To 5
Print #1,HS(J);",";NA$(J);",";
Next J
Print #1," "
Close 1
NBIT:
Paper 0 : Cls : Curs Off : Flash Off
If MEG
Locate 6,6 : Unpack 6 To 0
Else
Locate 0,14 : Centre("High Score Table")
Locate 0,10 : Centre("GAME OVER")
End If
Ink 5,0,0
For J=1 To 5
A$=Mid$(Str$(HS(J)),2)
A$=Right$("000000"+A$,6)
Text 36,(19*J)+137,A$
Text 100,(19*J)+137,Left$(NA$(J)+Space$(28),21)
Next J
Clear Key
Do : If(Mouse Key=0) and(Fire(1)=0) : Exit : End If : Loop
Do : If(Mouse Key) or(Inkey$<>"") or(Fire(1)) : Exit : End If : Loop
End Proc
Procedure NAME_GET
Screen Open 0,320,200,2,Lowres : Show On
Colour 1,$FFF : Curs Off
Reserve Zone 29
For J=1 To 26 Step 10
For K=0 To 9
If J+K<27
Print At(K*3+5,(J/10)*3+5);Zone$(Border$(Chr$(64+J+K),1),J+K);
End If
Next K
Next J
Limit Mouse 150,70 To 400,150
Print At(23,11);Zone$(Border$("_",1),27)
Print At(26,11);Zone$(Border$("<<",1),28)
Print At(30,11);Zone$(Border$("*",1),29)
Print At(9,14);Border$(At(29,16),1)
A$=""
Do
Do
Z=Mouse Zone
If Z>0 and Z<27
Dec Z : J=Z/10 : K=Z-(Z/10*10)
Inverse On : Print At(K*3+5,J*3+5);Border$(Chr$(65+J*10+K),1);
Repeat : Until Mouse Zone<>Z+1 or Mouse Key<>0
Inverse Off : Print At(K*3+5,J*3+5);Border$(Chr$(65+J*10+K),1);
Inc Z
End If
If Z>26 and Z<30 :
Inverse On
If Z=27 : Print At(23,11);Border$("_",1); : End If
If Z=28 : Print At(26,11);Border$("<<",1); : End If
If Z=29 : Print At(30,11);Border$("*",1); : End If
Repeat : Until Mouse Zone<>Z or Mouse Key<>0
Inverse Off
If Z=27 : Print At(23,11);Border$("_",1); : End If
If Z=28 : Print At(26,11);Border$("<<",1); : End If
If Z=29 : Print At(30,11);Border$("*",1); : End If
End If
If Mouse Key<>0 and Z<>0 : Exit : End If
Loop
If(Z>0) and(Z<27) and(Len(A$)<20) : A$=A$+Chr$(64+Z) : End If
If(Z=27) and(Len(A$)<20) : A$=A$+" " : End If
If(Z=28) and(Len(A$)>1) : A$=Left$(A$,Len(A$)-1) : End If
If(Z=29) : Exit : End If
Print At(9,15);Space$(20)
Print At(9,15);A$
Bell 30+Z : Wait 5
Repeat : Until Mouse Key=0
Loop
If A$="" : A$="**John Dough**" : End If
A#=Len(A$)/2.0 : A$=Left$(Space$(20),10-A#)+A$ : A$=Left$(A$+Space$(20),20)
Cls
End Proc[A$]