home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
AMOS PD CD
/
amospdcd.iso
/
301-325
/
apd303
/
level_editor.amos
/
level_editor.amosSourceCode
Wrap
AMOS Source Code
|
1991-07-13
|
5KB
|
203 lines
'LitterBusters' Level Editor v1.02
'
'Tim Davis July 1991
'
'(C)1991 PATSOFT
Screen Open 0,320,256,2,Lowres
Palette $986,$0
'
Dim LEV$(5,15),CANS(5),KEYS(5),STX(5),STY(5),TWN$(5),TME(5)
If Exist("lb-levels")
Curs Off
Flash 1,"(fff,15)(986,15)"
Centre "Loading levels"
Open In 1,"lb-levels"
For LVL=1 To 5
For ROW=1 To 15
Input #1,LEV$(LVL,ROW)
Next
Input #1,CANS(LVL),KEYS(LVL),STX(LVL),STY(LVL),TWN$(LVL),TME(LVL)
Next
Close
Flash Off
Colour 1,$0
Curs On
Else
Curs Off
Flash 1,"(fff,15)(986,15)"
Centre "Loading default levels"
Open In 1,"lb-levels.bak"
For LVL=1 To 5
For ROW=1 To 15
Input #1,LEV$(LVL,ROW)
Next
Input #1,CANS(LVL),KEYS(LVL),STX(LVL),STY(LVL),TWN$(LVL),TME(LVL)
Next
Close
Flash Off
Colour 1,$0
Curs On
End If
'
Auto View Off
Screen Open 1,320,256,2,Lowres
Centre "Commands"
Print
Print
Print " C-Collectable B-Bag"
Print " K-Key P-Points"
Print " W-Wall I-Invisible wall"
Print " D-Door M-Manhole"
Print " L-Life S-Start"
Print " E-Exit R-Rubbish tip"
Print " Del-Delete Help-This!"
Print " F10-Clear level"
Print
Print
Centre "Press any key"
Curs Off
Screen Hide 1
Auto View On
Repeat
Screen 0
Cls
Repeat
Print At(0,5);"Use 0 to load original levels"
Home
Input "which level [1-5] ?";CL
If CL=0
Cls
Curs Off
Flash 1,"(fff,15)(986,15)"
Centre "Loading default levels"
Open In 1,"lb-levels.bak"
For LVL=1 To 5
For ROW=1 To 15
Input #1,LEV$(LVL,ROW)
Next
Input #1,CANS(LVL),KEYS(LVL),STX(LVL),STY(LVL),TWN$(LVL),TME(LVL)
Next
Close
Flash Off
Colour 1,$0
Curs On
End If
Until(CL>0 and CL<6)
Cls 0
Set Curs 255,129,129,129,129,129,129,255
'
ST=0 : EXI=0
For Y=1 To 15
For X=1 To 38
Print At(X,Y);Mid$(LEV$(CL,Y),X,1)
If Mid$(LEV$(CL,Y),X,1)="S"
ST=1
End If
If Mid$(LEV$(CL,Y),X,1)="E"
Inc EXI
End If
Next
Next
Print At(2,22);"Level ";CL;At(0,24);"Press [Esc] to finish"
Print At(1,1);
X=1
Y=1
Repeat
Repeat
A$=Inkey$
Until A$<>""
A$=Upper$(A$)
S=Scancode
If S=76 and Y>1 Then Cup : Y=Y-1
If S=77 and Y<15 Then Cdown : Y=Y+1
If S=78 and X<38 Then Cright : X=X+1
If S=79 and X>1 Then Cleft : X=X-1
If S=89 Then Proc CLRLVL[CL]
If S=95
Screen Show 1
Wait Key
Screen Hide 1
End If
RW$=LEV$(CL,Y)
If S=70
Print At(X,Y);"+";Cleft$;
Proc CHKSE
Mid$(RW$,X,1)="+"
End If
While A$<>Chr$(0)
If A$="W" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="R" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="C" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="K" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="B" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="I" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="M" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="P" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="L" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If A$="D" Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$
If Asc(A$)=69 Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$ : Inc EXI
If Asc(A$)=83 and ST=0 Then Print At(X,Y);A$;Cleft$; : Proc CHKSE : Mid$(RW$,X,1)=A$ : ST=1 : STX(CL)=X : STY(CL)=Y
A$=Chr$(0)
Wend
LEV$(CL,Y)=RW$
Until(S=69 and ST=1 and EXI>0)
'
Locate 2,26
Put Key TWN$(CL)
Input "Name ";TWN$(CL)
TWN$(CL)=Left$(TWN$(CL),10)
Put Key Str$(TME(CL))
Input "Time (secs) ";TME(CL)
TME(CL)=Abs(TME(CL))
If TME(CL)>999 Then TME(CL)=999
CANS(CL)=0 : KEYS(CL)=0
For Y=1 To 15
For X=1 To 38
BIT$=Lower$(Mid$(LEV$(CL,Y),X,1))
If BIT$="c" Then Inc CANS(CL)
If BIT$="k" Then Inc KEYS(CL)
Next
Next
'
Print "Edit another level ?";
YN$=Upper$(Input$(1))
Until YN$<>"Y"
'
Open Out 1,"lb-levels"
For LVL=1 To 5
For ROW=1 To 15
Print #1,LEV$(LVL,ROW)
Next
Print #1,CANS(LVL)
Print #1,KEYS(LVL)
Print #1,STX(LVL)
Print #1,STY(LVL)
Print #1,TWN$(LVL)
Print #1,TME(LVL)
Next
Close
End
'
Procedure CHKSE
Shared RW$,X,EXI,ST
If Asc(Mid$(RW$,X,1))=69
Dec EXI
End If
If Asc(Mid$(RW$,X,1))=83
ST=0
End If
End Proc
Procedure CLRLVL[L]
Memorize X : Memorize Y
Shared LEV$(),STX(),STY(),KEYS(),CANS(),TWN$(),TME(),ST,EXI
ST=0 : EXI=0 : KEYS(L)=0 : CANS(L)=0 : TWN$(L)="" : TME(L)=0
For Y=1 To 15
LEV$(L,Y)=String$("+",38)
Next
For Y=1 To 15
For X=1 To 38
Print At(X,Y);Mid$(LEV$(L,Y),X,1)
Next
Next
Remember X : Remember Y
End Proc