home *** CD-ROM | disk | FTP | other *** search
AMOS Source Code | 1991-11-13 | 5.3 KB | 236 lines |
- ' Explode
- ' By Gal-on Broner
- ' Barbarian Minds 1991.
- '
- Screen Open 0,320,200,8,Lowres
- Curs Off
- Dim BOARD(5,5) : Rem number of bombs in each square.
- Dim BOARD$(5,5) : Rem does the square belong to the white
- Rem or to the black?
- Dim OVERBOMB(5,5) : Rem What is the maximum number if bombs
- Rem aloud in the square?
- Global BOARD(),BOARD$(),OVERBOMB(),X,Y,PL
- Screen Hide : Wait Vbl
- CREATE_ICON_BANK
- INIT_GAME:
- CREATE_OVERBOMB_TABLE
- Cls 0
- CREATE_BOARD
- Screen Show : Wait Vbl
- X=1 : Y=1 : PL=2
- Rem
- Rem now for the main game routine.
- Rem
- MAIN_GAME:
- PL=3-PL
- CURSOR_ON
- 6 LETTER$="" : LETTER$=Inkey$
- If(Asc(LETTER$)<28 or Asc(LETTER$)>31) and(Asc(LETTER$)<>13) Then Goto 6
- LE=Asc(LETTER$)
- CURSOR_OFF
- If LE=28 Then Add X,1,1 To 5 : Rem Right Arrow.
- If LE=29 Then Add X,-1,1 To 5 : Rem Left Arrow.
- If LE=30 Then Add Y,-1,1 To 5 : Rem Up Arrow.
- If LE=31 Then Add Y,1,1 To 5 : Rem Down Arrow.
- If LE=13 Then Goto PLACE_BOMB : Rem put bomb on the spot.
- CURSOR_ON
- Goto 6
- Rem
- Rem Placing the bomb.
- Rem
- PLACE_BOMB:
- Rem
- Rem Illigal. Tring to put a bomb in an enemy square.
- Rem
- If(PL=1 and(BOARD$(X,Y)="b")) or(PL=2 and(BOARD$(X,Y)="w"))
- CURSOR_ON
- Goto 6
- End If
- Rem
- Rem Move ok. Increase amount of bombs in sqaure.
- Rem
- Inc BOARD(X,Y)
- If PL=1
- BOARD$(X,Y)="w"
- PLACE_WHITE_BOMB
- Else
- BOARD$(X,Y)="b"
- PLACE_BLACK_BOMB
- End If
- Rem
- Rem If amount of bombs reaches the max amount of bombs aloud
- Rem Blow the square up!
- Rem
- If BOARD(X,Y)=OVERBOMB(X,Y)
- KEEPY=Y
- KEEPX=X
- Goto BLOWUP
- End If
- Goto MAIN_GAME
- Rem
- Rem Blow up!
- Rem
- BLOWUP:
- If PL=1 Then C$="w" Else C$="b"
- X1=((X-1)*34)+2 : Y1=((Y-1)*34)+2
- Rem
- Rem create the Blow up effect.
- Rem
- Ink 4 : Boom
- For CIR=1 To 15
- Circle X1+16,Y1+16,CIR
- Next CIR
- Ink 0
- For CIR=1 To 15
- Circle X1+16,Y1+16,CIR
- Next CIR
- CREATE_BOARD
- Ink 0
- Bar X1,Y1 To X1+30,Y1+30
- Rem
- Rem Increase Bombs capacity inside sqaures beside
- Rem the sqaure who blowed up.
- Rem
- BOARD(X,Y)=0 : BOARD$(X,Y)=""
- If Y>1
- Inc BOARD(X,Y-1)
- BOARD$(X,Y-1)=C$
- End If
- If Y<5
- Inc BOARD(X,Y+1)
- BOARD$(X,Y+1)=C$
- End If
- If X>1
- Inc BOARD(X-1,Y)
- BOARD$(X-1,Y)=C$
- End If
- If X<5
- Inc BOARD(X+1,Y)
- BOARD$(X+1,Y)=C$
- End If
- Rem
- Rem Ok, Now go thourgh the whole board and redraw bombs position.
- Rem
- For Y=1 To 5
- For X=1 To 5
- If BOARD(X,Y)>OVERBOMB(X,Y) Then BOARD(X,Y)=OVERBOMB(X,Y)
- If BOARD$(X,Y)="w" Then PLACE_WHITE_BOMB
- If BOARD$(X,Y)="b" Then PLACE_BLACK_BOMB
- Next X
- Next Y
- Rem
- Rem Since a Blow has accured, I need to check for win!
- Rem
- ALIVE$="n"
- For X=1 To 5
- For Y=1 To 5
- If PL=1 and(BOARD$(X,Y)="b") Then ALIVE$="y"
- If PL=2 and(BOARD$(X,Y)="w") Then ALIVE$="y"
- Next Y
- Next X
- If ALIVE$="n" Then Goto FINITO
- Rem
- Rem Ok, if the game is still going, check for a chain-reaction.
- Rem
- For Y=1 To 5
- For X=1 To 5
- If BOARD(X,Y)=OVERBOMB(X,Y) Then Goto BLOWUP
- Next X
- Next Y
- Y=KEEPY
- X=KEEPX
- Goto MAIN_GAME
- FINITO:
- Locate 23,8
- If PL=1
- Print "Brown";
- Else
- Print "White";
- End If
- Print " Wins!"
- Locate 23,10 : Print "Another Game?"
- Locate 23,11 : Print " (Y/N) "
- 1
- YN$=""
- While YN$=""
- YN$=Inkey$
- Wend
- YN$=Upper$(YN$)
- If YN$="Y" Then Goto INIT_GAME
- Run "Amoner002:Autoexec.Amos"
- End
- Procedure CREATE_ICON_BANK
- Cls 0
- Ink 1 : Circle 10,10,3 : Paint 10,10
- Ink 2 : Circle 30,10,3 : Paint 30,10
- Ink 4
- Plot 10,6 : Plot 10,5 : Plot 11,4
- Plot 30,6 : Plot 30,5 : Plot 31,4
- Erase 2
- Get Icon 1,6,4 To 14,14
- Get Icon 2,26,4 To 34,14
- Make Icon Mask
- End Proc
- Procedure CREATE_OVERBOMB_TABLE
- For X=1 To 5
- For Y=1 To 5
- If(X=1 or Y=1 or X=5 or Y=5) and(X=Y or X-4=Y or X+4=Y)
- OVERBOMB(X,Y)=2
- Goto 5
- End If
- If Y=1 or X=1 or Y=5 or X=5
- OVERBOMB(X,Y)=3
- Goto 5
- End If
- OVERBOMB(X,Y)=4
- 5 BOARD$(X,Y)="" : BOARD(X,Y)=0
- Next Y
- Next X
- End Proc
- Procedure CREATE_BOARD
- Ink 6
- For LOO=0 To 170 Step 34
- Draw LOO,0 To LOO,170
- Draw 0,LOO To 170,LOO
- Next LOO
- For LOO=1 To 171 Step 34
- Draw LOO,1 To LOO,171
- Draw 1,LOO To 171,LOO
- Next LOO
- Pen 4 : Paper 0
- Locate 23,1 : Print " Explode! "
- Locate 23,2 : Print "By Galon Broner"
- Locate 23,3 : Print "Barbarian Minds"
- Locate 23,4 : Print " 1991 "
- Paper 0 : Pen 5
- End Proc
- Procedure CURSOR_ON
- Ink PL
- X1=((X-1)*34)+2 : Y1=((Y-1)*34)+2
- Box X1+14,Y1+2 To X1+17,Y1+14
- Box X1+2,Y1+14 To X1+14,Y1+17
- Box X1+14,Y1+17 To X1+17,Y1+29
- Box X1+17,Y1+14 To X1+29,Y1+17
- End Proc
- Procedure CURSOR_OFF
- Ink 0
- X1=((X-1)*34)+2 : Y1=((Y-1)*34)+2
- Box X1+14,Y1+2 To X1+17,Y1+14
- Box X1+2,Y1+14 To X1+14,Y1+17
- Box X1+14,Y1+17 To X1+17,Y1+29
- Box X1+17,Y1+14 To X1+29,Y1+17
- End Proc
- Procedure PLACE_WHITE_BOMB
- X1=((X-1)*34)+2 : Y1=((Y-1)*34)+2
- If BOARD(X,Y)>0 Then Paste Icon X1+2,Y1+2,1
- If BOARD(X,Y)>1 Then Paste Icon X1+21,Y1+2,1
- If BOARD(X,Y)>2 Then Paste Icon X1+2,Y1+21,1
- If BOARD(X,Y)>3 Then Paste Icon X1+21,Y1+21,1
- End Proc
- Procedure PLACE_BLACK_BOMB
- X1=((X-1)*34)+2 : Y1=((Y-1)*34)+2
- If BOARD(X,Y)>0 Then Paste Icon X1+2,Y1+2,2
- If BOARD(X,Y)>1 Then Paste Icon X1+21,Y1+2,2
- If BOARD(X,Y)>2 Then Paste Icon X1+2,Y1+21,2
- If BOARD(X,Y)>3 Then Paste Icon X1+21,Y1+21,2
- End Proc