Code: Select all
rem Raining Hard
rem iPhone 6 Plus / 8.3
rem I modified my dads fountian code. :)
rem it needs sound...
gosub initialize
loop:
refresh off
graphics clear fl/255,fl/255,fl/255
if fl>0 then fl=max(0,fl-10)
if fl=0 and int(rnd(100))=1 then fl=int(rnd(100)+155)
gosub drawrain
gosub drawsplashes
refresh on
goto loop
drawsplashes:
for a=1 to numsplash
if splashy(a)>sh then goto skipsplash
fill color 200/255,200/255,200/255
x=splashx(a) ! y=splashy(a)
fill rect x,y to x+2,y+2
splashy(a)=splashy(a)+splashyv(a)
splashx(a)=splashx(a)+splashxv(a)
splashyv(a)=splashyv(a)+0.4
skipsplash:
next a
return
addsplash:
found=0!b=0
do
b=b+1
if splashy(b)>sh then found=1
until found=1 or b=numsplash
if found=0 then return
splashy(b)=sh-10
splashyv(b)=-int(rnd(4)+3)
splashx(b)=x
return
drawrain:
for a=1 to numrain
x=rainx(a) ! y=rainy(a) ! s=rains(a)
b1=br1(s)/255 ! b2=br2(s)/255 ! b3=br3(s)/255
s1=sr1(s) ! s2=sr2(s) ! s3=sr3(s)
draw color b1,b1,b1 ! draw line x,y-s1 to x,y+s1
draw color b2,b2,b2 ! draw line x,y-s2 to x,y+s2
draw color b3,b3,b3 ! draw line x,y-s3 to x,y+s3
y=y+6*rains(a)
if y<sh-10 then goto skiprain
rainx(a)=int(rnd(sw))
y=-50
gosub addsplash
gosub addsplash
skiprain:
rainy(a)=y
next a
return
initialize:
graphics
sw=screen_width()
sh=screen_height()
pi=3.1415
dim co(361),si(361)
for a=0 to 360
co(a)=cos(a*(pi/180))
si(a)=sin(a*(pi/180))
next a
numrain=50
dim rainx(numrain+1),rainy(numrain+1),rains(numrain+1)
for a=1 to numrain
rainx(a)=int(rnd(sw))
rainy(a)=int(rnd(sh))
rains(a)=(a%3)+2
next a
numsplash=40
dim splashx(numsplash+1),splashy(numsplash+1)
dim splashxv(numsplash+1),splashyv(numsplash+1)
for a=1 to numsplash
splashxv(a)=int(rnd(6))-3
splashy(a)=sh
next a
dim br1(5),br2(5),br3(5),sr1(5),sr2(5),sr3(5)
for a=1 to 4
br1(a)=a*25
br2(a)=a*30
br3(a)=a*50
sr1(a)=a*10
sr2(a)=a*8
sr3(a)=a*5
next a
return