For those of you questioning the speed, the generation of a world takes between 20 and 40 seconds (depending on world type). Saved worlds load instantly. Cave levels (which generate when you reach the bottom of the map) take around 15 seconds. To generate a world, I used rand, so the top of the terrain is between 0 and 1 (8 pixels)(on zoom standard). In the customization menu, you can change the smoothness of a world (smooth worlds take longer to generate). These times were calculated using an average smoothness world with average numbers of trees.
Here's the code (it's very messy, but easy enough to follow):
Code:
12→D
0→U
AxesOff
ClrDraw
ClrHome
ZStandard
BackgroundOff
0→I
Menu("USE SAVED WORLD?","LOAD SAVE",LZ,"CREATE NEW",UQ)
Lbl LZ
If R=1
Goto LM
Goto FE
Lbl UQ
Menu("TREE SPAWNS","COMMON",LK,"SPARSE",LJ,"RARE",LI
Lbl LK
1→W
Goto LH
Lbl LJ
2→W
Goto LH
Lbl LI
3→W
Lbl LH
Menu("TERRAIN","SMOOTH",NO,"AVERAGE",NP,"ROUGH",NQ
Lbl NO
.4→O
Goto NR
Lbl NP
.6→O
Goto NR
Lbl NQ
.8→O
Lbl NR
0→F
Menu("BIOME","TEMPERATE",PQ,"TAIGA",PR,"ALIEN",PU,"RANDOM",PS
Lbl PQ
0→J
Goto PT
Lbl PR
1→J
Goto PT
Lbl PU
2→J
Goto PT
Lbl PS
randInt(0,2)→J
Lbl PT
If J=1
Goto SN
If J=2
Goto AN
11→L
0→K
W+1→W
While 1=1
L+2→L
L→X
randInt(1,W)→Z
If Z=2
Then
rand→Z
Z+X→X
rand→Z
Z→Y
randInt(1,2)→Z
If Z=2
1+Y→Y
Y+1.5→Y
Line(X,0,X,Y,1,16)
For(Z,0,.5,.1)
Circle(X,Y+.5,Z,14)
End
End
K+1→K
If K=10
Goto LG
End
Lbl LG
10.15→X
.5→G
.5→D
.5→S
While 1=1
X+.15→X
Lbl RM
rand→Z
If Z>G+O or Z<G-O
Goto RM
Z→G
Line(X,Z,X,2,1,14)
Lbl RN
rand→Z
If Z>D+O or Z<G-O
Goto RN
Z→D
Z-1→Z
Line(X,Z,X,5,1,16)
Lbl RO
rand→Z
If Z>S+O or Z<S-O
Goto RO
Z→S
Z-4→Z
Line(X,Z,X,10,1,GRAY
If X≥10.15
Goto WR
End
Lbl SN
11→L
W+1→W
While 1=1
If L=9
Goto ST
L+2→L
L→X
randInt(1,W)→Z
If Z=2
Then
rand→Z
Z+X→X
rand→Y
Y+1→Y
randInt(1,2)→Z
If Z=1
Y+1→Y
Line(X,0,X,Y,1,16)
Line(X-.5,Y+.2,X+.5,Y+.2,1,14)
Line(X-.4,Y+.6,X+.4,Y+.6,1,14)
Line(X-.3,Y+1,X+.3,Y+1,1,14)
Line(X-.2,Y+1.4,X+.2,Y+1.4,1,14)
Line(X-.1,Y+1.8,X+.1,Y+1.8,1,14)
Line(X,Y+2.2,X,Y+2.2,1,14)
Line(X-.5,Y+.4,X+.5,Y+.4,1,14)
Line(X-.4,Y+.8,X+.4,Y+.8,1,14)
Line(X-.3,Y+1.2,X+.3,Y+1.2,1,14)
Line(X-.2,Y+1.6,X+.2,Y+1.6,1,14)
Line(X-.1,Y+2,X+.1,Y+2,1,14)
End
End
Lbl ST
11→X
.5→G
.5→D
While 1=1
X+.15→X
Lbl KM
rand→Z
Z→Y
If Y>G+O or Y<G-O
Goto KM
Line(X,3,X,Y,1,LTGRAY
Z→G
Lbl KN
rand→Z
Z-3→Y
If Z>D+O or Z<D-O
Goto KN
Line(X,Y,X,11,1,GRAY
Z→D
If X≥11
Goto WR
End
Lbl AN
11→X
.5→G
ClrDraw
While 1=1
X+.15→X
Line(X,10,X,10,1,12)
If X≥10.01
Goto VY
End
Lbl VY
0→M
While 1=1
M+1→M
randInt(9,9)→X
randInt(1,9)→Y
Pt-On(X,Y,1,YELLOW
If M=15
Goto UT
End
Lbl UT
11→X
While 1=1
X+.15→X
Lbl QL
rand→Z
If Z>G+.4 or Z<G-.4
Goto QL
Z→G
Line(X,Z,X,Z-2,1,RED
Line(X,Z-2,X,Z-4,1,ORANGE
Line(X,Z-4,X,Z-6,1,RED
Line(X,Z-6,X,Z-8,1,ORANGE
Line(X,Z-8,X,Z-10,1,RED
Line(X,Z-10,X,Z-11,1,ORANGE
If X≥10.01
Goto KF
End
Lbl KF
randInt(7,7)→X
For(P,0,1.9,.1)
Circle(X,7,P,MEDGRAY
End
Circle(X,7,2,NAVY
For(P,0,.9,.1)
Circle(X,8,P,GREEN
End
Circle(X,8,1,NAVY
Pt-On(X,6,NAVY
Pt-On(X-1.15,6.3,NAVY
Pt-On(X+1.15,6.3,NAVY
Pt-On(X+1.5,7.3,NAVY
Pt-On(X-1.5,7.3,NAVY
X→V
Lbl RX
LTBLUE→D
0→X
1.5→Y
X→S
Y→T
4.5→E
Goto XR
Lbl FE
4.5→E
B→X
C→Y
LTBLUE→D
RecallPic 1
Lbl XR
While 1=1
E-.2→E
Line(V-1,E,V+1,E,1,MAGENTA
Line(V-1,E+.6,V+1,E+.6,1,12)
If E=.5
Then
Line(V-1,E,V+1,E,1,12
Line(V-1,E+.2,V+1,E+.2,1,12
Line(V-1,E+.4,V+1,E+.4,1,12
4.5→E
End
Pt-On(X,Y,1,D)
If S≠X or T≠Y
Pt-On(S,T,1,12)
getKey→Z
X→S
Y→T
If Z=24
Then
X-.15→X
If X≤10.01
10→X
End
If Z=26
Then
X+.15→X
If X≥10.01
10→X
End
If Z=25
Then
Y+.3→Y
If Y≥10.01
10→Y
End
If Z=34
Then
Y-.3→Y
If Y≤10.01
10→Y
End
If Z=21
Then
2→I
Goto VU
End
End
Lbl WR
0→X
1.5→Y
Y→T
X→S
12→D
Goto PY
Lbl LM
RecallPic 1
B→X
C→Y
1→U
Lbl PY
While 1=1
Pt-On(X,Y,1,D)
If S≠X or T≠Y
Pt-Off(S,T)
getKey→Z
X→S
Y→T
If Z=24
Then
X-.15→X
If X≤10
10→X
End
If Z=26
Then
X+.15→X
If X≥10
10→X
End
If Z=25
Then
Y+.3→Y
If Y≥10.01
10→Y
End
If Z=34
Then
Y-.3→Y
If Y≤10
Then
Pt-Off(X,Y+.3)
Goto CV
End
End
If Z=21
Then
0→I
Goto VU
End
End
Lbl VU
Menu("GAME PAUSED","RETURN TO GAME",RY,"INVENTORY",IY,"SAVE AND QUIT",QS,"QUIT",QT,"SETTINGS",BE
Lbl RY
If I=0
Goto PY
If I=2
Goto XR
Goto RU
Lbl IY
Lbl QS
Pt-Off(X,Y)
If I=0
1→R
If I=2
2→R
If I=0 or I=2
StorePic 1
If I=1
StorePic 2
X→B
Y→C
Lbl QT
ClrDraw
ClrHome
Disp " "
AxesOn
ClrHome
Stop
Lbl BE
ClrHome
Menu("SETTINGS","BACK",VU,"CHARACTER",CT
Lbl CT
Menu("COLOR","BLACK",BK,"BLUE",BU,"MAGENTA",MG,"RED",RD
Lbl BU
NAVY→D
Goto BE
Lbl BK
12→D
Goto BE
Lbl MG
13→D
Goto BE
Lbl RD
11→D
Goto BE
Lbl CV
X→θ
StorePic 1
ClrDraw
If U=1
Then
RecallPic 2
Goto RK
End
11→X
ClrDraw
While 1=1
X+.15→X
rand→Z
Z-4→Z
rand→V
V-8→V
Line(X,10,X,Z,1,GRAY
Line(X,10,X,V,1,GRAY
If X≥11
Goto RK
End
Lbl RK
10→Y
θ→X
X→S
Y→T
Lbl RU
While 1=1
Pt-On(X,Y,1,D)
If S≠X or T≠Y
Pt-Off(S,T)
getKey→Z
X→S
Y→T
If Z=24
Then
X-.15→X
If X≤10.15
10→X
End
If Z=26
Then
X+.15→X
If X≥10.15
10→X
End
If Z=25
Then
Y+.2→Y
If Y≥10.2
Then
Pt-Off(X,Y-.2)
Pt-On(X,10,1,GRAY
StorePic 2
1→U
ClrDraw
RecallPic 1
10→Y
Goto PY
End
End
If Z=34
Then
Y-.2→Y
If Y≤10.01
10→Y
End
If Z=21
Then
1→I
Goto VU
End
End