home *** CD-ROM | disk | FTP | other *** search
/ AMOS PD CD / amospdcd.iso / 176-200 / apd197 / defusion.amos / defusion.amosSourceCode < prev    next >
AMOS Source Code  |  1991-04-06  |  7KB  |  273 lines

  1. 'April 91
  2. Dim C(7),X(4),PC(7),FX(4),FY(4),USED(4),POS(5)
  3. Global LEVEL,SCORE,FUSE,DELAY,PIC,C(),X(),PC(),FX(),FY(),USED(),GUESS,MV,POS()
  4. Global LEVEL,SCORE
  5. Randomize Timer
  6. STRT:
  7. TITLE : INIT
  8. MAIN:
  9. THINKOFCOLOURS : MIXCOLOURS : MAINLOOP
  10. Procedure MAINLOOP
  11.    Unpack 6 To 0
  12.    For A=1 To 4 : Ink PC(A)*2+3,
  13.   Bar X(A),86 To X(A)+13,97
  14. Next A
  15.    SCORE$=Str$(SCORE) : SCORE$=Right$(SCORE$,Len(SCORE$)-1)
  16.    SCORE$=String$("0",5-Len(SCORE$))+SCORE$
  17.    LEV$=Str$(LEVEL) : LEV$=Right$(LEV$,Len(LEV$)-1)
  18.    LEV$=String$("0",3-Len(LEV$))+LEV$
  19.    Gr Writing 0 : Ink 0, : Text 247,138,SCORE$ : Text 257,96,LEV$
  20.    Ink 11, : Text 248,137,SCORE$
  21.    Text 256,95,LEV$
  22.    Gr Writing 1 : Reserve Zone 10
  23.    For A=1 To 4
  24.       Set Zone A,X(A),70 To X(A)+12,83
  25.       Set Zone A+4,X(A),101 To X(A)+12,114
  26.    Next A
  27.    Set Zone 9,137,153 To 184,163
  28.    Set Zone 10,228,48 To 301,58
  29. FUSE=1
  30. GUESS=0
  31.   Music 1 : Mvolume MV
  32.    While FUSE<(290*DELAY)
  33.       BURNFUSE
  34.       If Mouse Key
  35.          CHKMOVE
  36.       End If 
  37.    Wend 
  38.    NDGAME
  39. End Proc
  40. Procedure INIT
  41.    DELAY=7 : MV=60 : SCORE=0 : LEVEL=1
  42.    X(1)=125 : X(2)=145 : X(3)=164 : X(4)=183
  43.    FX(1)=153 : FX(2)=161 : FX(3)=153 : FX(4)=161
  44.    FY(1)=123 : FY(2)=123 : FY(3)=132 : FY(4)=132
  45.    Sprite 1,100,100,5
  46.    Channel 1 To Sprite 1
  47.    Amal 1,"L: Let X=XM ; Let Y=YM ; Jump L"
  48.    Amal On 
  49.    Voice 1
  50.    Volume 1,35
  51. End Proc
  52. Procedure BURNFUSE
  53.    Inc FUSE
  54.    Ink 4, : Add PIC,1,1 To 4
  55.    Bar 316-(FUSE/DELAY),176 To 328-(FUSE/DELAY),194
  56.    Paste Bob 313-(FUSE/DELAY),177,PIC : Wait Vbl : Wait Vbl 
  57. End Proc
  58. Procedure XPLODE
  59.    Music Off : Volume 63
  60.    Boom 
  61.    Ink 4, : Bar 0,165 To 320,200
  62.    For A=10 To 21
  63.       Bob 1,1,167,A
  64.       Wait 3 : Wait Vbl 
  65.    Next 
  66.    Bar 0,165 To 30,200
  67. End Proc
  68. Procedure THINKOFCOLOURS
  69.    L:
  70.    For A=1 To 4
  71.       C(A)=Rnd(5)+1
  72.    Next A
  73.    For A=1 To 4
  74.       For AA=A+1 To 5
  75.          If C(A)=C(AA) Then Goto L
  76.       Next AA
  77.    Next A
  78. End Proc
  79. Procedure MIXCOLOURS
  80.    M:
  81.    For A=1 To 4
  82.       PC(A)=Rnd(5)+1
  83.    Next A
  84.    For A=1 To 4
  85.       For AA=A+1 To 5
  86.          If PC(A)=PC(AA) Then Goto M
  87.       Next AA
  88.    Next A
  89.    If C(1)=PC(1) or C(2)=PC(2) or C(3)=PC(3) or C(4)=PC(4) Then MIXCOLOURS
  90.   ' DRWBOARD 
  91. End Proc
  92. Procedure CHKMOVE
  93.    MZ=Mouse Zone
  94.    If MZ=0 Then Pop Proc
  95.    If MZ=9 Then Play 1,50,0 : CHKLIGHTS : Pop Proc
  96.    If MZ=10 Then MV=MV xor 60 : Mvolume MV : BURNFUSE : Wait Vbl : Pop Proc
  97.    For A=1 To 4 : USED(A)=0 : Next A
  98.    If MZ<=4
  99.       Dec PC(MZ)
  100.       If PC(MZ)=0
  101.          PC(MZ)=6
  102.       End If 
  103.       MVCOLUP[MZ]
  104.    Else 
  105.       Add PC(MZ-4),1,1 To 6
  106.       MVCOLDN[MZ-4]
  107.    End If 
  108. End Proc
  109. Procedure MVCOLUP[CNUM]
  110.    For A=1 To 11
  111.       BURNFUSE
  112.       Ink(PC(CNUM)*2)+3,
  113.       Bar X(CNUM),97-A To X(CNUM)+13,97
  114.       Play 1,(A*2)+CNUM+40,0
  115.       Wait Vbl 
  116.    Next 
  117. End Proc
  118. Procedure MVCOLDN[CNUM]
  119.    For A=1 To 11
  120.       BURNFUSE
  121.       Ink(PC(CNUM)*2)+3,
  122.       Bar X(CNUM),86 To X(CNUM)+13,86+A
  123.       Play 1,((12-A)*2)+CNUM+40,0
  124.       Wait Vbl 
  125.    Next 
  126. End Proc
  127. Procedure CHKLIGHTS
  128.    S:
  129.    For A=1 To 4
  130.       USED(A)=0
  131.       POS(A)=Rnd(3)+1
  132.    Next A
  133.    For A=1 To 4
  134.       For AA=A+1 To 5
  135.          If POS(A)=POS(AA) Then Goto S
  136.       Next AA
  137.    Next A
  138.    For A=1 To 4
  139.       FX=FX(POS(A))+4 : FY=FY(POS(A))+4
  140.       If C(A)=PC(A)
  141.          Ink 9, : CIRC[FX,FY,3] : USED(A)=9
  142.       Else Ink 11, : CIRC[FX,FY,3]
  143.       End If 
  144.    Next 
  145.    For A=1 To 4
  146.       FX=FX(POS(A))+4 : FY=FY(POS(A))+4
  147.       For AA=1 To 4
  148.          If C(A)=PC(AA)
  149.             If USED(A)=0
  150.                Ink 13, : CIRC[FX,FY,3] : USED(A)=13
  151.             End If 
  152.          End If 
  153.       Next AA
  154.    Next A
  155.    SHSCORE
  156. End Proc
  157. Procedure CIRC[CX,CY,R]
  158.    For RR=1 To R
  159.       Circle CX,CY,RR
  160.    Next 
  161.    Ink 0,
  162.    Circle CX,CY,R
  163. End Proc
  164. Procedure SHSCORE
  165.    For A=1 To 4
  166.       Ink(PC(A)*2)+3,
  167.       CIRC[21+(A*8),69+(GUESS*8),3]
  168.       If USED(A)=0 Then USED(A)=11
  169.       Ink USED(A),
  170.       CIRC[56+(POS(A)*7),69+(GUESS*8),2]
  171.    Next 
  172.    If C(1)=PC(1) and C(2)=PC(2) and C(3)=PC(3) and C(4)=PC(4) Then CONGRATS
  173.    Inc GUESS
  174.    If GUESS=10 Then NDGAME
  175. End Proc
  176. Procedure NDGAME
  177.    XPLODE
  178.    Wait 30
  179.    Ink 16, : Bar 98,65 To 222,147
  180.    Music 1 : Mvolume 60 : Gr Writing 0
  181.    Ink 1,
  182.    Text 100,76," You failed to"
  183.    Text 100,86,"   find the"
  184.    Text 100,96,"code which was:"
  185.    Gr Writing 1
  186.    For A=1 To 4
  187.       Ink(C(A)*2)+3,
  188.       CIRC[(A*16)+118,115,7]
  189.    Next A
  190.    While Mouse Key=0 : Wend 
  191.    For V=60 To 1 Step -1 : Mvolume V : Wait Vbl : Next 
  192. Goto STRT
  193. End Proc
  194. Procedure CONGRATS
  195.    SCORE=SCORE+(FUSE/10)
  196.    SCORE=SCORE+((11-GUESS)*5)
  197.    SCORE=SCORE*5
  198.    Ink 16, : Bar 98,65 To 222,147
  199.    Music 1 : Mvolume 30 : Gr Writing 0
  200.    Ink 0,16 : Text 101,76,"Congratulations"
  201.    Ink 1,16 : Text 102,77,"Congratulations"
  202.    Text 100,90," You found the"
  203.    Text 100,100,"  combination"
  204.    Text 100,135,"  and defused"
  205.    Text 100,145,"   the bomb."
  206.    SCORE$=Str$(SCORE) : SCORE$=Right$(SCORE$,Len(SCORE$)-1)
  207.    SCORE$=String$("0",5-Len(SCORE$))+SCORE$
  208. Gr Writing 1
  209. Ink 0,25
  210. Text 247,138,SCORE$
  211. Gr Writing 0
  212. Ink 11, : Text 248,137,SCORE$
  213. Gr Writing 1
  214. For A=1 To 4
  215.       Ink(PC(A)*2)+3,
  216.       CIRC[(A*16)+118,115,7]
  217.    Next 
  218.    Ink 4,
  219.    For A=320 To 0 Step -1
  220.       Draw A,169 To A,199
  221.       Wait Vbl 
  222.    Next 
  223.    While Mouse Key=0 : Wend 
  224.    For V=30 To 1 Step -1 : Mvolume V : Wait Vbl : Next 
  225.    Dec DELAY : Inc LEVEL : FUSE=1
  226. If DELAY<1 Then DELAY=1
  227.   Goto MAIN
  228. End Proc
  229. Procedure TITLE
  230.    Music 1 : Mvolume 60 : Sprite Off : Show On 
  231.    Screen Open 0,250,140,32,Lowres : Curs Off : Flash Off : Cls 0 : Get Sprite Palette 
  232.    Flash 11,"(100,3)(300,3)(500,3)(700,3)(900,3)(a00,3)(c00,3)(a00,3)(900,3)(700,3)(500,3)(300,3)"
  233.    Screen Display 0,175,100,,
  234.    Limit Mouse 225,183 To 340,226
  235.    Reserve Zone 2 : Paste Bob 37,20,22
  236.    Paper 0 : Pen 7
  237.    Locate 3,1 : Print "Pixel Precision Presents"
  238.    Pen 1
  239.    Locate 7,8 : Print "By Dominic Ramsey"
  240.    Pen 24
  241.    Locate 8,11 : Print Border$(Zone$("     PLAY     ",1),1)
  242.    Locate 8,14 : Print Border$(Zone$(" INSTRUCTIONS ",2),2)
  243.    GM:
  244.    While Mouse Key=0 : MZ=Mouse Zone : Wend 
  245.    If MZ=0 Then Goto GM
  246.    Flash Off : Fade 3
  247.    If MZ=1
  248.       For V=63 To 0 Step -2
  249.          Mvolume V : Wait Vbl 
  250.       Next V
  251.    Music Off : Limit Mouse : Hide On 
  252.       Pop Proc
  253.    End If 
  254. Fade 2 : Wait 30
  255.    Screen Open 0,320,200,4,Lowres : Curs Off : Cls 0 : Palette 0,0,0,0
  256.    Paper 0 : Pen 1 : Hide On 
  257.    Fade 3,0,$FFF,$F55,$F0
  258.    X$=At(8,1)+Pen$(1)+"Defusion    By D. Ramsey"+At(0,3)+Pen$(2)
  259.    X$=X$+"Your mission, should you decide to      accept it is to defuse as many"
  260.    X$=X$+" bombs as possible before they explode. This is   done by finding "
  261.    X$=X$+"the special colour      combination to defuse each bomb."+At(0,9)
  262.    X$=X$+"Each colour can be changed by clicking  on the arrows above and"
  263.    X$=X$+" below  each     colour. Your chosen combination can thenbe tried by"
  264.    X$=X$+"  clicking  on the 'DEFUSE'  button."+At(0,15)
  265.    X$=X$+"Four lights below the main panel will   now indicate how close you were "
  266.    X$=X$+"to the  correct combination.   A green light    indicates  a  correct colour "
  267.    X$=X$+"in the     correct  place,  orange  indicates  a   correct colour in the wrong "
  268.    X$=X$+"place, and  red indicates a wrong colour."+At(0,23)
  269.    X$=X$+"You have 10 chances to find the code    before the bomb explodes."
  270.    Print X$
  271.    While Mouse Key=0 : Wend : X$="" : Fade 2 : Wait 30 : Show On 
  272.    TITLE
  273. End Proc