-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy path1276.bas
More file actions
85 lines (80 loc) · 2.06 KB
/
Copy path1276.bas
File metadata and controls
85 lines (80 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
'Autumn scene.bas for SmallBASIC 0.12.0 05-11-2015 MGA/B+ from:
' Autumn scene.txt for Just Basic 2015-10-03 MGA/B+ translated from:
' tree3.bas SmallBASIC 2015-05-13 translated from
' tree2.txt Naalaa 2015-05-14 MGA/B+ and help from chrisws!
' code inspired by tree found on Naalaa by Peter W
repeat
'the sky
for i=0 to 200
line 0,i,xmax,i,rgb(0,0,205+.25*i)
next
'the earth
for i=200 to ymax
line 0,i,xmax,i,rgb(0,40+.18*i,0)
next
'yard is too neat
for i=203 to ymax step 5
j=1
repeat
x=rnd*xmax
leaf2 x,i
j=j+1
until (500-i)*.25-j<0
next
'the skyline
for i=1 to 27
x=rnd*xmax:s=rnd*201:y=200-s:cc=rnd*75
rect x,y,x+s,y+s,rgb(cc,cc,cc) filled
next
'the trees 7 back to front
DrawTree 1100,350,55,-90,7
DrawTree 800,270,65,-90, 7
DrawTree 550,325,70,-90,7
DrawTree 325,380,65,-90,7
DrawTree 125,400,75,-90,7
DrawTree 900,430,80,-90,7
DrawTree 600,500,85,-90,7
DrawTree 300,525,75,-90,7
'more giants
DrawTree 50,500,105,-90,7
DrawTree 1150,800,125,-90,7
DrawTree 400,875,115,-90,7
delay 2000
until len(inkey)
'====================================================== for tree only
sub DrawTree(x1, y1, Size, theta, depth)
local SA1,SA2,SF1,SF2,x2,y2
SA1=7+23*rnd
SA2=7+23*rnd
SF1=.60+.30*rnd
SF2=.60+.30*rnd
x2 = x1 + cos(rad(theta)) * Size
y2 = y1 + sin(rad(theta)) * Size
line x1,y1,x2,y2,rgb(20+rnd*40,35+rnd*40,0)
if depth<5 then leaf x2,y2
if depth<=0 then leaf x2,y2 : exit sub
DrawTree x2,y2,Size*SF1+8-depth,theta-SA1,depth-1
DrawTree x2,y2,Size*SF2+8-depth,theta+SA2,depth-1
end
sub leaf(x,y)
local sp,n,xoff,yoff,woff,hoff
sp=15
for n=1 to 5
xoff=x+rnd*sp-rnd*sp
yoff=y+rnd*sp-rnd*sp
woff=3+rnd*3
hoff=3+rnd*3
rect xoff,yoff,xoff+woff,yoff+hoff,rgb(50+rnd*205,100+rnd*155,0) filled
next
end
sub leaf2(x,y)
local sp,n,xoff,yoff,woff,hoff
sp=32
for n=1 to 5
xoff=x+rnd*41-20
yoff=y+rnd*5-2
woff=3+rnd*.000012*y*y
hoff=3+rnd*.000005*y*y
rect xoff,yoff,xoff+woff,yoff+hoff,rgb(rnd*128,50+rnd*75,rnd*20) filled
next
end