We just did something about this is physics class, so I thought I'd give it a go in DBPro. Here you go.
`setup
sync on : sync rate 60
set display mode 1024,768,16 : hide mouse
`setup world
type vec2d
x as float
y as float
mag as float
endtype
global grav as float : grav=1.0
`setup ramp
type tramp
x as float
y as float
tx as float
ty as float
length as float
tang as float
ang as float
endtype
global _ramp as tramp
global ang as float
_ramp.length=500
_ramp.x=100 : _ramp.y=300
`box
type tbox
pos as vec2d
frcd as vec2d
frcf as vec2d
acc as vec2d
vel as vec2d
mass as float
weight as float
endtype
global _box as tbox
setBox(100,300,100,0.98,0.98)
`main loop
do
`do stuff
if spacekey()
_box.frcd.x=_box.frcd.x*0 : _box.frcd.y=_box.frcd.y*0
_box.pos.x=100 : _box.pos.y=300
_box.vel.x=_box.vel.x*0 : _box.vel.y=_box.vel.y*0
if upkey() then _ramp.tang=_ramp.tang+2
if downkey() then _ramp.tang=_ramp.tang-2
_ramp.ang=_ramp.tang : ang=wrapvalue(90-_ramp.ang)
_ramp.tx=_ramp.x+(sin(_ramp.ang)*_ramp.length)
_ramp.ty=_ramp.y+(cos(_ramp.ang)*_ramp.length)
endif
_box.frcd.mag=_box.weight*(sin(ang))
_box.frcd.x=cos(ang)*_box.frcd.mag
_box.frcd.y=sin(ang)*_box.frcd.mag
_box.acc.x=_box.frcd.x/_box.mass
_box.acc.y=_box.frcd.y/_box.mass
_box.vel.x=_box.vel.x+_box.acc.x
_box.vel.y=_box.vel.y+_box.acc.y
_box.vel.x=_box.vel.x*_box.frcf.x
_box.vel.y=_box.vel.y*_box.frcf.y
_box.pos.x=_box.pos.x+_box.vel.x
_box.pos.y=_box.pos.y+_box.vel.y
`draw box
ink rgb(0,128,255),0
box _box.pos.x,_box.pos.y,_box.pos.x+10,_box.pos.y+10
`draw ramp
ink rgb(255,255,255),0 : text 10,10,"Angle: "+str$(int(ang))
drawRamp(rgb(0,255,0))
`text
ink rgb(255,255,255),0
text 10,30,"Hold space to adjust ramp (up and down arrow keys)"
sync
cls
loop
`functions
function drawRamp(col)
ink col,0
line _ramp.x,_ramp.y,_ramp.tx,_ramp.ty
line _ramp.x,_ramp.y,_ramp.x,_ramp.ty
line _ramp.x,_ramp.ty,_ramp.tx,_ramp.ty
endfunction
function setBox(x as float, y as float, mass as float,fx as float, fy as float)
_box.pos.x=x : _box.pos.y=y : _box.mass=mass
_box.frcf.x=fx : _box.frcf.y=fy : _box.frcf.mag=sqrt((fx^2)+(fy^2))
_box.weight=mass*grav
endfunction