home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
sourcecode
/
games
/
maze_game.amos
/
maze_game.amosSourceCode
< prev
next >
Wrap
AMOS Source Code
|
1992-07-12
|
8KB
|
315 lines
Close Editor
Rem ****************************************************************
Rem * *
Rem * PROGRAM NAME : Maze Craze *
Rem * *
Rem * AUTHOR : Bernie Wiemers and Kelly Adey *
Rem * *
Rem * DATE : 01 August 1990 (c) *
Rem * *
Rem * VERSION : V1.02 *
Rem * *
Rem * COMMENTS : Amos Version adapted from original game *
Rem * that was written using Amigabasic by *
Rem * Bernie Wiemers and Kelly Adey. *
Rem * *
Rem ****************************************************************
Rem * VERSION/ | PROGRAMMER/ *
Rem * DATE | COMMENT *
Rem *----------|---------------------------------------------------*
Rem * V1.03 | Bernie Wiemers & Kelly Adey *
Rem * 01/12/90 | Added colours to the walls & Floors. *
Rem *----------|---------------------------------------------------*
Rem * V1.03 | Added sound samples and background music *
Rem * 09/12/90 | Added disk selection to get multiple mazes *
Rem * 2.30 AM! | *
Rem ****************************************************************
Rem
COORD1=0
COORD2=0
COORD3=0
COORD4=0
Global COORD1,COORD2,COORD3,COORD4
FL=0
S1=1
Rem number of locations
M=10
Dim ST(3)
Dim LOCATION$(M,M)
Dim V$(4,4)
Dim F$(4)
Dim CURRENTPOS$(1,4)
DER$=" "
Gosub SETUP
MAIN:
Gosub MOVE
DERE:
Locate 42,29
Paper 0
Print F$(ION)
L=X+290
Q=Y+3
MAP[L,Q,DER$,ION]
DIS:
DER$=Inkey$
DER$=Upper$(DER$)
If(DER$<>"Q") and(DER$<>"L") and(DER$<>"R") and(DER$<>"F") and(DER$<>"S") Then Goto DIS
If FL=1 and(V$(1,COORD1)="1") and(DER$="F") Then Sam Play 3,1,10000 : Goto DIS
If DER$="Q"
Mvolume 0
For A=50 To -230 Step -1
Screen Display 0,,A,320,250
Wait Vbl
Next A
Run "Maze.Amos:Game/End_Menu.AMOS"
End If
If DER$="L" Then ION=ION-1
If ION<1 Then ION=4
If DER$="R" Then ION=ION+1
If ION>4 Then ION=1
If(DER$="F") and(ION=1) Then X=X-1
If(DER$="F") and(ION=2) Then Y=Y+1
If(DER$="F") and(ION=3) Then X=X+1
If(DER$="F") and(ION=4) Then Y=Y-1
If(DER$="S") and(S1=0)
S1=1
Mvolume 7
DER$=" "
End If
If(DER$="S") and(S1=1)
S1=0
Mvolume 0
End If
If Y>M Then Y=M
If Y<1 Then Y=1
If X>M Then X=M
If X<1 Then X=1
Gosub MOVE
Sam Play 4,4,7000
For Z1=1 To 2000
Next Z1
Sam Play 3,4,7000
Q2=Rnd(100)
If Q2>95 Then Sam Play 2,3,10000
Goto DERE
MOVE:
FL=0
A=X
B=Y
For I=1 To 3
CURRENTPOS$=LOCATION$(A,B)
For J=1 To 4
V$(I,J)=Mid$(CURRENTPOS$,J,1)
Next J
If ION=1 Then A=A-1
If ION=2 Then B=B+1
If ION=3 Then A=A+1
If ION=4 Then B=B-1
If B<1 Then B=1
If B>M Then B=M
If A<1 Then A=1
If A>M Then A=M
Next I
FACING[ION]
Gosub MAPOUT
Return
End
MAPOUT:
BLANK
Rem first floor
SIDEWALL[220,180,21,140,475,595,7,3]
If(V$(1,COORD1)="1") or(V$(1,COORD1)="2")
FL=1
Rem first deadend
WALLOUT[140,180,475,60,7]
End If
Rem final exit
If V$(1,COORD1)="2" Then WALLOUT[243,180,373,85,0]
If V$(1,COORD2)="1"
Rem first rightwall
SIDEWALL[595,475,21,60,180,220,7,2]
Else
Rem first right passage
SIDEPAS[475,21,594,60,594,218,179,7,2]
End If
If V$(1,COORD4)="1"
Rem first leftwall
SIDEWALL[21,140,21,60,180,220,7,1]
Else
Rem first leftpassage
SIDEPAS[21,21,140,60,139,179,218,7,1]
End If
If FL=1 Then Return
If FL=0 Then
Rem second floor
SIDEWALL[180,160,140,210,405,475,8,3]
If V$(2,COORD2)="1"
Rem second rightwall
SIDEWALL[475,405,60,80,160,180,8,2]
Else
Rem second rightpassage
SIDEPAS[403,58,474,80,474,178,159,8,2]
End If
If V$(2,COORD4)="1"
Rem second leftwall
SIDEWALL[140,210,60,80,160,180,8,1]
Else
Rem second left passage
SIDEPAS[141,55,210,80,210,159,178,8,1]
End If
If(V$(2,COORD1)="1") or(V$(2,COORD1)="2")
FL=1
Rem second deadend
WALLOUT[210,160,405,80,8]
End If
Rem second out
If V$(2,COORD1)="2" Then WALLOUT[268,159,348,98,6]
If FL=1 Then Return
Rem third floor
If FL=0 Then
SIDEWALL[160,145,210,260,355,405,9,3]
If V$(3,COORD2)="1"
Rem third rightwall
SIDEWALL[405,355,80,95,145,160,9,2]
Else
Rem third right passage
SIDEPAS[355,80,403,94,404,157,144,9,2]
End If
If V$(3,COORD4)="1"
Rem third leftwall
SIDEWALL[211,260,80,95,145,160,9,1]
Else
Rem third leftpassage
SIDEPAS[211,80,260,95,259,144,157,9,1]
End If
If V$(3,COORD1)="0"
Ink 0
Bar 261,95 To 354,145
Ink 2
Draw 260,145 To 355,145
End If
If(V$(3,COORD1)="1") or(V$(3,COORD1)="2")
FL=1
Rem third deadend
WALLOUT[258,145,355,95,9]
End If
Rem first out
If V$(3,COORD1)="2" Then WALLOUT[288,144,328,108,13]
Return
SETUP:
Screen Open 0,640,320,16,Hires
Flash Off
Curs Off
Cls 0
Rem LOCATION DATA
Data "North"," East","South"," West"
For I=1 To 4
Read F$(I)
Next I
Show On
F$=Fsel$("Mazes/*.mze","Maze2.mze","MAZE CRAZE","Please pick a maze")
Hide On
Open In 1,F$
For J=1 To 3
Input #1,ST(J)
Next J
For XZ=1 To M
For YZ=1 To M
Input #1,LOCATION$(XZ,YZ)
Next YZ
Next XZ
Close 1
X=ST(1)
Y=ST(2)
ION=ST(3)
Load "graphics/Screen.Abk",5
Unpack 5 To 0
For A=-230 To 50
Screen Display 0,,A,320,250
Wait Vbl
Next A
Flash Off
Curs Off
Ink 6
Bar 0,0 To 10,10
Load "music/Samples.Abk",6
Sam Bank 6
Load "music/Funky1.Abk"
Mvolume 7
Music 1
Volume %1110,35
Music 1
Return
Procedure BLANK
Ink 0
Polygon 122,53 To 260,94 To 355,94 To 491,53
End Proc
Procedure SIDEWALL[A,B,C,D,E,F,C1,D1]
Ink 2
If D1<3 Then Polyline A,C To B,D To B,E To A,F Else Polyline C,A To D,B To E,B To F,A
Ink C1
If D1=1 Then Polygon A+1,C+2 To B-1,D+1 To B-1,E-1 To A+1,F-2
If D1=2 Then Polygon A-1,C+2 To B+1,D+1 To B+1,E-1 To A-1,F-2
If D1=3 Then Polygon C+5,A-1 To D+1,B+1 To E-1,B+1 To F-5,A-1
End Proc
Procedure SIDEPAS[X1,Y1,X2,Y2,X5,Y5,Y6,C1,D1]
Ink 0
If D1=1 Then Polygon X1,Y1 To X2,Y2 To X1,Y2
If D1=2 Then Polygon X2,Y1 To X1,Y2 To X2,Y2
Ink C1
If D1=1
Bar X1-1,Y2+2 To X5,Y5
Polygon X1+1,Y6 To X1+1,Y5 To X5-3,Y5+1
End If
If D1=2
Bar X1-1,Y2+2 To X5,Y6
Polygon X2-1,Y6 To X2-1,Y5 To X1+2,Y6+1
End If
Ink 2
If D1=1 Then Box X1-1,Y2 To X2,Y5+1
If D1=2 Then Box X1+1,Y2 To X2+1,Y6+1
End Proc
Procedure WALLOUT[X1,Y1,X2,Y2,C1]
Ink 2
Box X1,Y1 To X2,Y2
Ink C1
Bar X1+1,Y2+1 To X2-1,Y1-1
If X1=243
Locate 31,9
Paper 7
Pen 2
Print "YOU'VE MADE IT!"
For G=1 To 10000
Next G
Mvolume 0
For A=50 To -230 Step -1
Screen Display 0,,A,320,250
Wait Vbl
Next A
Dir$="Maze.Amos:Game/"
Run "End_Menu.AMOS"
End If
End Proc
Procedure MAP[X,Y,DER$,ION]
Ink 0
Bar 289,4 To 311,16
If(DER$="F") and(ION=3) Then X=X-1
If(DER$="F") and(ION=4) Then Y=Y+2
If(DER$="F") and(ION=1) Then X=X+1
If(DER$="F") and(ION=2) Then Y=Y-2
If X=>310 Then X=310
If Y=>14 Then Y=14
If Y<=6 Then Y=6
If X<=290 Then X=290
Ink 4
Plot X,Y
End Proc
Procedure FACING[ION]
COORD1=ION
COORD2=ION+1
COORD3=ION+2
COORD4=ION+3
If COORD2>4 Then COORD2=COORD2-4
If COORD3>4 Then COORD3=COORD3-4
If COORD4>4 Then COORD4=COORD4-4
End Proc