Ive added a slight bounce to the sand which is proportional to the amount of time that it has been in freefall. [and without using another line
].
`SAND
sand=500:block=1000:make object sphere 1,0:delete object 1:sync on:dim sand(sand,7):dim screen(650,490):dim block(block,3):backdrop on:color backdrop 0
do:for t=1 to sand:if sand(t,1)=0:sand(t,1)=1:sand(t,2)=320:sand(t,3)=0:endif:if sand(t,1)=1:screen(sand(t,2),sand(t,3))=0:oldy=sand(t,3):if sand(t,5)=0:sand(t,3)=sand(t,3)+rnd(2)+1:endif
if sand(t,5)=1:sand(t,3)=sand(t,3)-(sand(t,6)/120):sand(t,6)=sand(t,6)-40:if sand(t,6)<(0-(sand(t,7))):sand(t,6)=0:sand(t,5)=0:endif:if sand(t,3)<0:sand(t,3)=0:endif
noldx=sand(t,2):if sand(t,4)=0:sand(t,2)=sand(t,2)-(sand(t,7)/(rnd(20)+130)):endif:if sand(t,4)=1:sand(t,2)=sand(t,2)+(sand(t,7)/(rnd(20)+130)):endif:if screen(sand(t,2),sand(t,3))=1:sand(t,2)=noldx:endif:endif
if sand(t,3)>478:sand(t,3)=478:endif:if screen(sand(t,2),sand(t,3))>0:if screen(sand(t,2),sand(t,3))>1:sand(t,5)=1:sand(t,7)=sand(t,6):sand(t,4)=rnd(1):endif:sand(t,3)=oldy:oldx=sand(t,2):sand(t,2)=sand(t,2)+rnd(4)-2
if screen(sand(t,2),sand(t,3))>0:sand(t,2)=oldx:endif:endif:if sand(t,3)=478:oldx=sand(t,2):sand(t,2)=sand(t,2)+rnd(4)-2:if screen(sand(t,2),sand(t,3))>0:sand(t,2)=oldx:endif:endif:ink rgb(rnd(255),rnd(255),rnd(255)),0:dot sand(t,2),sand(t,3)
sand(t,6)=sand(t,6)+(sand(t,3)-oldy):if sand(t,2)=320 and sand(t,3)=478:sand(t,1)=0:sand(t,6)=0:endif:if sand(t,1)=1:screen(sand(t,2),sand(t,3)=1:endif:endif:next t
blockdone=0:ink rgb(255,255,0),0:for t=1 to block:if block(t,1)=1:box block(t,2),block(t,3),block(t,2)+5,block(t,3)+5:endif:if mouseclick()=1 and blockdone=0 and block(t,1)=0:block(t,1)=1:block(t,2)=mousex():block(t,3)=mousey()
for r=0 to 5:for e=0 to 5:screen(mousex()+r,mousey()+e)=2:next e:next r:blockdone=1:endif:if mouseclick()=2 and block(t,1)=1 and block(t,2)>mousex()-6 and block(t,2)<mousex()+6 and block(t,3)>mousey()-6 and block(t,3)<mousey()+6
for m=0 to 5:for z=0 to 5:screen(block(t,2)+m,block(t,3)+z)=0 : next m : next z:block(t,1)=0:endif:next t:sync:loop
`
As for a restart button i dont see the need - as soon as the sand hits middle of the bottom of the screen it comes out the top again. If the sand isnt going through very quick, draw a funnel above the very middle of the bottom of the screen. This will make the landing sand get to the middle pixel and thus get back to the top of the screen far faster.