And this one should do gravity
sync on: sync rate 20
a=480
b=480
roll#=340
speed# = 0.0
do
cls
if keystate(30)=1 then a=a-1
if keystate(44)=1 then a=a+1
if keystate(40)=1 then b=b-1
if keystate(53)=1 then b=b+1
if a<0 then a=0
if a>480 then a=480
if b<0 then b=0
if b>480 then b=480
line 0,a,640,b
rem 680.0 here is screen width in pixels (I think)
frac# = roll#/640.0
height# = frac#*b + (1.0 - frac#)*a
if height#<a or height#>b then speed# = speed# - (a-b)*00000.1
if height#>a or height#<b then speed# = speed# + (b-a)*00000.1
roll# = roll# + speed#
rem make sure circle doesn't leave screen
if speed#<0 and roll#<20 then speed# = 0.0: roll# = 20
if speed#>0 and roll#>620 then speed# = 0.0: roll# = 620
circle roll#,height# - 20,20
sync
loop
I've corrected a few other small bugs which might have been a problem e.g. I think the default screen width is 640. I can't seem to slow down the circle
, maybe it just needs a bit of messing around, or something. Hope that makes sense
.