home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
351-375
/
apd366
/
chain.amos
/
chain.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1990-03-03
|
12KB
|
438 lines
Screen Open 0,320,255,32,Lowres
Dim GRID(6,6,3)
Dim SCORE(2)
Load "Chain_Reaction:chain_reaction.abk"
WINNER=0 : Gosub WIN
THE_BEGINNING:
Gosub BEGIN
Gosub _SCREEN_SETUP
Shift Up 2,14,16,1
Gosub SET_UP
'
Repeat
PL1:
PLY=1
Gosub COORDINATES
If GRID(X,Y,3)<>2 and GRID(X,Y,3)<>3
GRID(X,Y,1)=GRID(X,Y,1)+1
GRID(X,Y,3)=1
Else
Bell
Goto PL1
End If
X2=X : Y2=Y
Gosub UP_DATE
Gosub CHECK
Gosub SCORES
'
PL2:
PLY=2
Gosub COORDINATES
If GRID(X,Y,3)<>1 and GRID(X,Y,3)<>3
GRID(X,Y,1)=GRID(X,Y,1)+1
GRID(X,Y,3)=2
Else
Bell
Goto PL2
End If
X2=X : Y2=Y
Gosub UP_DATE
Gosub CHECK
Gosub SCORES
'
If GB=1
If Rnd(4)=1
X2=Rnd(5)+1 : Y2=Rnd(5)+1
If GRID(X2,Y2,3)=0
GRID(X2,Y2,3)=3
GRID(X2,Y2,1)=0
Gosub UP_DATE
End If
End If
End If
TURN=TURN+1
Until TURN>MXTURN
If SCORE(1)>SCORE(2) : WINNER=1 : Gosub WIN : End If
If SCORE(2)>SCORE(1) : WINNER=2 : Gosub WIN : End If
If SCORE(1)=SCORE(2) : WINNER=3 : Gosub WIN : End If
End
'
SCORES:
If PLY=1 Then PLUS=0
If PLY=2 Then PLUS=254
Ink 0 : Bar 19+PLUS,129 To 44+PLUS,141
Ink 24
B$=Str$(TURN)
If TURN<10 : Text 26+PLUS,139,Right$(B$,1) : End If
If TURN<100 and TURN>9 : Text 23+PLUS,139,Right$(B$,2) : End If
If TURN>99 : Text 20+PLUS,139,Right$(B$,3) : End If
For I=1 To 2
If I=2 Then PLUS=254 Else PLUS=0
Ink 0 : Bar 19+PLUS,93 To 44+PLUS,105
Ink 24
PLY=I : Gosub COUNT
B$=Str$(SCORE(I))
If SCORE(I)<10 Then Text 26+PLUS,102,Right$(B$,1)
If SCORE(I)<100 and SCORE(I)>9 Then Text 23+PLUS,102,Right$(B$,2)
If SCORE(I)>99 Then Text 20+PLUS,102,Right$(B$,3)
Next
If TURN>1
If SCORE(1)=0 : WINNER=2 : Gosub WIN : End If
If SCORE(2)=0 : WINNER=1 : Gosub WIN : End If
End If
Return
'
WIN:
Fade 5
Wait 5*16
Unpack 7 To 0
Flash Off : Paper 0 : Hide On
Locate 0,11
Set Rainbow 1,1,255,"(6,1,15)(6,-1,15)","","(1,15,1)(6,-1,15)(6,1,15)"
Rainbow 1,0,120,255
Ink 0 : Bar 0,0 To 30,30
VO=1
If WINNER<>0
Unpack 2,0,71
If WINNER=1 : Unpack 8,0,220 : End If
If WINNER=2 : Unpack 4,0,220 : End If
If WINNER=3 : Unpack 3,0,220 : End If
Shift Up 2,14,16,1
Volume 30
For K=1 To 10
Wait Rnd(50)+1
Sam Play VO,1,Rnd(2000)+6000
VO=VO*2
If VO>8 : VO=1 : End If
Next
Volume %10,63
Sam Play %10,2,20000
Wait Key
Ink 0 : Bar 0,71 To 320,251 : Wait Vbl
End If
Goto THE_BEGINNING
Return
'
BEGIN:
Pen 1
Set Curs 255,255,255,255,255,255,255,255
Print " CHAIN REACTION" : Print
Print " Written By:"
Print " DR. Strange" : Print
Print " Instructions (Y/N)"; : Input A$
If A$="y" Then _INSTRUCTIONS
If A$="Y" Then _INSTRUCTIONS
Locate 0,17
Print " Do you want green bombs(Y/N)"; : Input A$
GB=0
If A$="y" Then GB=1
If A$="Y" Then GB=1
Print " How many Turns (0 for infinite turns)"
Print " "; : Input MXTURN
If MXTURN>999 Then MXTURN=999
If MXTURN=0 Then MXTURN=1000000
Volume 30
Rainbow 1,0,0,0
Fade 5
Wait 5*16
Return
'
SET_UP:
VO=1
XPOS=39 : YPOS=42
TURN=1 : PLY=0 : X=1 : Y=1
A$="A 1,(7,2)(8,2)(9,2)(10,2)(11,2)(12,2)(13,2)(14,2)(15,2)"
For X1=1 To 6
For Y1=1 To 6
GRID(X1,Y1,2)=4
If X1=1 Then GRID(X1,Y1,2)=3
If X1=6 Then GRID(X1,Y1,2)=3
If Y1=1 Then GRID(X1,Y1,2)=3
If Y1=6 Then GRID(X1,Y1,2)=3
GRID(X1,Y1,1)=0
GRID(X1,Y1,3)=0
Next
Next
SCORE(1)=0 : SCORE(2)=0
GRID(6,6,2)=2 : GRID(6,1,2)=2
GRID(1,6,2)=2 : GRID(1,1,2)=2
Return
'
_SCREEN_SETUP:
Screen Open 0,320,320,32,Lowres
Curs Off : Flash Off : Hide On
Screen Hide 0
Unpack 6 To 0
For I=0 To 31
Colour I,0
Next
Screen Show 0
Fade 3,$0,$0,$F00,$F30,$F60,$F90,$FC0,$FF0,$8,$800,$FFF,$FFF,$FFF,$FFF,$F00,$FF0,,,,,,,,,$FFF,$80,$F,$3F,$6F,$9F,$CF,$FF
Wait 3*16
Fade 3,,,,,,,,,,,$AAC,$77A,$558,$346,,,,$9F,$6B,$59,$47,$36,$24,$12,,,,,,,,,
Wait 3*16
Return
'
UP_DATE:
If GRID(X2,Y2,3)=1 Then Ink 9
If GRID(X2,Y2,3)=2 Then Ink 8
If GRID(X2,Y2,3)=3 Then Ink 25
Bar X2*30+XPOS,Y2*30+YPOS To X2*30+XPOS+28,Y2*30+YPOS+28
Paste Bob X2*30+XPOS,Y2*30+YPOS,4+Rnd(2)
If GRID(X2,Y2,3)<>3
If GRID(X2,Y2,1)<4
Paste Bob X2*30+XPOS,Y2*30+YPOS,GRID(X2,Y2,1)
End If
End If
Wait 5
Return
'
CHECK:
Repeat
DETINATE=0
For X1=1 To 6
For Y1=1 To 6
If GRID(X1,Y1,3)=3 and GRID(X1,Y1,1)=1 Then Gosub OBLITERATE
If GRID(X1,Y1,1)=>GRID(X1,Y1,2) Then Gosub DET
Next
Next
Until DETINATE=0
Return
'
DET:
Sam Play VO,1,7000
VO=VO*2
If VO>8 Then VO=1
Gosub _EXPLOSION
If(X1+1)<7
If GRID((X1+1),Y1,3)=3
GRID((X1+1),Y1,3)=3
GRID((X1+1),Y1,1)=1
X2=X1+1 : Y2=Y1 : Gosub UP_DATE
Else
GRID((X1+1),Y1,3)=PLY
GRID((X1+1),Y1,1)=GRID((X1+1),Y1,1)+1
X2=X1+1 : Y2=Y1 : Gosub UP_DATE
End If
End If
If(X1-1)>0
If GRID((X1-1),Y1,3)=3
GRID((X1-1),Y1,3)=3
GRID((X1-1),Y1,1)=1
X2=X1-1 : Y2=Y1 : Gosub UP_DATE
Else
GRID((X1-1),Y1,3)=PLY
GRID((X1-1),Y1,1)=GRID((X1-1),Y1,1)+1
X2=X1-1 : Y2=Y1 : Gosub UP_DATE
End If
End If
If(Y1+1)<7
If GRID(X1,(Y1+1),3)=3
GRID(X1,(Y1+1),3)=3
GRID(X1,(Y1+1),1)=1
Else
GRID(X1,(Y1+1),3)=PLY
GRID(X1,(Y1+1),1)=GRID(X1,(Y1+1),1)+1
X2=X1 : Y2=Y1+1 : Gosub UP_DATE
End If
End If
If(Y1-1)>0
If GRID(X1,(Y1-1),3)=3
GRID(X1,(Y1-1),3)=3
GRID(X1,(Y1-1),1)=1
X2=X1 : Y2=Y1-1 : Gosub UP_DATE
Else
GRID(X1,(Y1-1),3)=PLY
GRID(X1,(Y1-1),1)=GRID(X1,(Y1-1),1)+1
X2=X1 : Y2=Y1-1 : Gosub UP_DATE
End If
End If
GRID(X1,Y1,1)=0 : GRID(X1,Y1,3)=0
DETINATE=1
Return
'
OBLITERATE:
Sam Play VO,1,7000
VO=VO*2
If VO>8 Then VO=1
Gosub _EXPLOSION
Ink 0
GRID(X1,Y1,3)=0
GRID(X1,Y1,1)=0
Bar X1*30+XPOS,Y1*30+YPOS To X1*30+XPOS+28,Y1*30+YPOS+28
If(X1+1)<7
GRID((X1+1),Y1,3)=0
GRID((X1+1),Y1,1)=0
Bar(X1+1)*30+XPOS,Y1*30+YPOS To(X1+1)*30+XPOS+28,Y1*30+YPOS+28
End If
If(X1-1)>0
GRID((X1-1),Y1,3)=0
GRID((X1-1),Y1,1)=0
Bar(X1-1)*30+XPOS,Y1*30+YPOS To(X1-1)*30+XPOS+28,Y1*30+YPOS+28
End If
If(Y1+1)<7
GRID(X1,(Y1+1),3)=0
GRID(X1,(Y1+1),1)=0
Bar X1*30+XPOS,(Y1+1)*30+YPOS To X1*30+XPOS+28,(Y1+1)*30+YPOS+28
End If
If(Y1-1)>0
GRID(X1,(Y1-1),3)=0
GRID(X1,(Y1-1),1)=0
Bar X1*30+XPOS,(Y1-1)*30+YPOS To X1*30+XPOS+28,(Y1-1)*30+YPOS+28
End If
Return
'
_EXPLOSION:
Ink 0
Bar X1*30+XPOS,Y1*30+YPOS To X1*30+XPOS+28,Y1*30+YPOS+28
Bob 1,X1*30+XPOS,Y1*30+YPOS,4
Channel 1 To Bob 1
Amal 1,A$
Amal On 1
For I=1 To 14
Wait Vbl : Synchro
Next
Bob 1,1,250,6
Wait 2
Return
'
COUNT:
SCORE(PLY)=0
For X1=1 To 6
For Y1=1 To 6
If GRID(X1,Y1,3)=PLY Then SCORE(PLY)=SCORE(PLY)+GRID(X1,Y1,1)
Next
Next
Return
'
COORDINATES:
Repeat
If Joy(1)=8 Then X=X+1
If Joy(1)=4 Then X=X-1
If Joy(1)=1 Then Y=Y-1
If Joy(1)=2 Then Y=Y+1
If Joy(1)=9 Then X=X+1 : Y=Y-1
If Joy(1)=10 Then X=X+1 : Y=Y+1
If Joy(1)=5 Then X=X-1 : Y=Y-1
If Joy(1)=6 Then X=X-1 : Y=Y+1
If X>6 Then X=6
If Y>6 Then Y=6
If Y<1 Then Y=1
If X<1 Then X=1
Ink 24
Polyline X*30+XPOS,Y*30+YPOS To X*30+XPOS+28,Y*30+YPOS To X*30+XPOS+28,Y*30+YPOS+28 To X*30+XPOS,Y*30+YPOS+28 To X*30+XPOS,Y*30+YPOS
Wait 6
Ink 0
Polyline X*30+XPOS,Y*30+YPOS To X*30+XPOS+28,Y*30+YPOS To X*30+XPOS+28,Y*30+YPOS+28 To X*30+XPOS,Y*30+YPOS+28 To X*30+XPOS,Y*30+YPOS
Until Joy(1)=16
Return
'
Procedure _INSTRUCTIONS
Curs Off
Pen 1
Colour 2,$FFF
Set Envel 1,1 To 1,50
Volume 1
For H=1 To 4
Ink 0
Bar 0,71 To 320,251
Locate 0,9
For I=1 To 20
Read A$
For J=1 To 40
Print Mid$(A$,J,1);
Pen 2 : Print "*"; : Pen 1
If Mid$(A$,J,1)<>" " Then Play 44,1
Wait Vbl
Cleft : Print " "; : Cleft
Next
Print
Next
Pen 2
Print "Press any key to continue....."
Pen 1
Wait Key
Next
Data " Chain Reaction is a two player board "
Data " game. Each player in turn must place "
Data " bombs on the grid, Each player has "
Data " different coloured bombs. Player one "
Data " has blue bombs, and player two has "
Data " red bombs. You can place a bomb on "
Data " any empty square on the grid, or you "
Data " can place one of your bombs on top of "
Data " another counter of your own, that is "
Data " already on the board. You may not "
Data " place one of your bombs on one of the "
Data " opponents bombs. "
Data " Each square can only hold a certain "
Data " number of bombs. This is equal to the "
Data " number of squares there are adjacent "
Data " to it minus one, both horizontally, "
Data " and vertically. e.g. corner squares "
Data " only hold one bomb, whereas edge "
Data " squares can hold two bombs. And inner "
Data " squares can hold three. "
Data " When the number of bombs on a square "
Data " exceeds that square's limit, then "
Data " there is an explosion, and the bombs "
Data " disperse onto the squares adjacent to "
Data " them, one bomb onto each. This is the "
Data " technique you must use to capture "
Data " your opponents squares: Arrange an "
Data " explosion next to a square occupied "
Data " By your opponent, Your bombs will "
Data " disperse, one will land on your "
Data " opponents bombs. All these bombs "
Data " now become your own. "
Data " Because in this game no bombs are "
Data " actually destroyed, the board will "
Data " slowly fill up. This means that if "
Data " you explode one square it may lead to "
Data " other explosions. This makes the game "
Data " unpredictable in its later stages. "
Data " And it is also where the game got its "
Data " name from. "
Data " The winner is the player who "
Data " eliminates all his opponents bombs. "
Data " Careless play can lead to being wiped "
Data " out within the first few moves. You "
Data " can alternatively play to a set "
Data " number of turns, the winner being the "
Data " player who has the most bombs at "
Data " the end of the game. "
Data " As an extra twist to the game at "
Data " random times green bombs appear, "
Data " neither player can move on this "
Data " square. The green bombs are triggered "
Data " if ANY bomb lands on them after an "
Data " explosion. The green bomb will then "
Data " explode destroying any bombs on "
Data " adjacent squares. You can use these "
Data " bombs to your advantage, but these "
Data " bombs can also be triggered by "
Data " careless mistakes, with disastrous "
Data " consequences! "
Data " You place bombs on the screen by "
Data " moving a white cursor about the board "
Data " using a joystick, pressing fire to "
Data " place a bomb on the highlighted "
Data " square. "
Data " These instructions may seem a bit "
Data " unclear, The best way to work out how "
Data " the game works is to play it! "
Data " "
Data " This game was written by: "
Data " "
Data " Dr. Strange "
Data " "
Data " Look out for my new game that is "
Data " currently under construction, its "
Data " 'Not Joust !!!!' "
Data " "
Data " Also look out for my 'Estranged' "
Data " demo, its ace !!!! "
Data " "
Ink 0
Bar 0,71 To 320,251
End Proc