home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1993-01-08 | 3.5 KB | 91 lines |
- ' An example of how to use procedure Arrows
- ' Firstly set up the screen
- SET_UP
- ' Now call Arrows procedure
- ARROWS_[10,50,-100,-50]
- ' Now get the number
- NUM=Param
- ' Now print the number
- Print Pen$(0)+"You selected number";NUM
- Procedure ARROWS_[SMALLEST,BIGGEST,X,Y]
- 'written by Brett George
- Curs Off : Reserve Zone : Reserve Zone 2 : Print
- _DRAW[252+X,75+Y,274+X,89+Y,1,""] : _DRAW[252+X,90+Y,274+X,104+Y,2,""] : Ink 0
- Polygon 262+X,86+Y To 262+X,82+Y To 259+X,82+Y To 263+X,78+Y To 267+X,82+Y To 264+X,82+Y To 264+X,86+Y
- Get Block 1,256+X,77+Y,16,10,0 : Get Block 2,256+X,77+Y,16,10,0 : Vrev Block 2
- AZ=SMALLEST
- PUSH[218+X,79+Y,244+X,94+Y,Str$(AZ)-" ",0]
- _DRAW[252+X,75+Y,274+X,89+Y,-1," "] : _DRAW[252+X,90+Y,274+X,104+Y,-1," "]
- Put Block 1 : Put Block 2,256+X,93+Y : ZB=3
- Repeat
- If ZB=1 Then _DRAW[252+X,75+Y,274+X,89+Y,-1,""] : Put Block 1 : ZB=3
- If ZB=2 Then _DRAW[252+X,90+Y,274+X,104+Y,-1,""] : Put Block 2,256+X,93+Y : ZB=3
- While Mouse Key=1
- If Mouse Zone=1
- If ZB=3
- ZB=1
- PUSH[252+X,75+Y,274+X,89+Y,"",0] : Put Block 1
- End If
- Wait 3
- If AZ<BIGGEST
- Inc AZ : Cls 1,222+X,82+Y To 242+X,91+Y : Text 224+X,89+Y,Str$(AZ)-" "
- End If
- End If
- If Mouse Zone=2
- If ZB=3
- ZB=2
- PUSH[252+X,90+Y,274+X,104+Y,"",0] : Put Block 2,256+X,93+Y
- End If
- Wait 3
- If AZ>SMALLEST
- Dec AZ : Cls 1,222+X,82+Y To 242+X,91+Y : Text 224+X,89+Y,Str$(AZ)-" "
- End If
- End If
- Wend
- Until(Mouse Key=3) or(Inkey$=" ")
- Cls : Curs On : Reserve Zone : Print : Del Block : ZB=0
- End Proc[AZ]
- Procedure PUSH[X,Y,X1,Y1,MESSAGE$,TIME]
- 'by Brett George
- Ink 1 : Bar X,Y To X1,Y1
- If MESSAGE$<>""
- Ink 0 : Box X-1,Y-1 To X1+1,Y1+1
- Ink 1 : Plot X-1,Y-1 : Plot X-1,Y1+1 : Plot X1+1,Y-1 : Plot X1+1,Y1+1
- End If
- Ink 5 : Draw X1,Y1 To X,Y1 : Draw X1,Y1-1 To X+1,Y1-1
- Draw X1,Y1 To X1,Y : Draw X1-1,Y1-1 To X1-1,Y : Ink 4
- Draw X,Y To X1,Y : Draw X,Y+1 To X1-1,Y+1 : Draw X,Y To X,Y1
- Draw X+1,Y To X+1,Y1-1 : _=((X+X1)/2-(Text Length(MESSAGE$))/2)-2 : Ink 0
- If MESSAGE$<>""
- Gr Writing 0 : Ink 4
- If(X+X1)/2<213 : Dec _ : ZZZ=-1 : End If
- If(X+X1)/2<426 : Inc _ : ZZZ=1 : End If
- Text _,(Y+Y1)/2+(Text Base/2)+1,MESSAGE$ : Ink 0
- If ZZZ : Inc _ : End If
- If ZZZ=1 : Dec _ : End If
- Text _,(Y+Y1)/2+Text Base/2,MESSAGE$
- End If
- If TIME>0 Then Wait TIME : _DRAW[X,Y,X1,Y1,-1,MESSAGE$] : Wait TIME
- End Proc
- Procedure _DRAW[X,Y,X1,Y1,NUM,MESSAGE$]
- Ink 0 : Box X-1,Y-1 To X1+1,Y1+1
- Ink 1 : Plot X-1,Y-1 : Plot X-1,Y1+1 : Plot X1+1,Y-1 : Plot X1+1,Y1+1
- Ink 1 : Bar X,Y To X1,Y1 : Ink 4 : Draw X1,Y1 To X,Y1
- Draw X1,Y1-1 To X+1,Y1-1 : Draw X1,Y1 To X1,Y : Draw X1-1,Y1 To X1-1,Y-1
- Ink 5 : Draw X,Y To X1,Y : Draw X,Y+1 To X1-1,Y+1
- Draw X,Y To X,Y1 : Draw X+1,Y To X+1,Y1-1 : If NUM>0 Then Set Zone NUM,X,Y To X1,Y1 : Ink 0
- If MESSAGE$<>""
- _=((X+X1)/2-(Text Length(MESSAGE$))/2)-2 : Gr Writing 0 : Ink 4
- If(X+X1)/2<213 : Dec _ : ZZZ=-1 : End If
- If(X+X1)/426 : Inc _ : ZZZ=1 : End If
- Text _,(Y+Y1)/2+(Text Base/2)+1,MESSAGE$ : Ink 0
- If ZZZ : Inc _ : End If
- If ZZZ=1 : Dec _ : End If
- Text _,(Y+Y1)/2+Text Base/2,MESSAGE$
- End If
- End Proc
- Procedure SET_UP
- 'by Brett George
- Screen Open 0,640,256,16,Hires : Curs Off : Flash Off
- Palette 0,$888,$777,$CCC,$444,$999 : Cls 1
- End Proc