Here is a function that will calculate the new yangle of a ball after it bounces off a wall. You specify the angle of the wall and ball. The angles are the y angles. So the wall will be strait up and down.
Here is the code
function bounce(walla,balla)
walla=wrapvalue(walla)
balla=wrapvalue(balla)
k1=wrapvalue(walla+180)
if walla<k1
if balla<walla then dec walla,180:dec k1,180
if balla>k1 then inc walla,180:inc k1,180
else
if balla<k1 then dec walla,180:dec k1,180
if balla>walla then inc walla,180:inc k1,180
endif
k2=abs(walla-balla)
k3=abs(k1-balla)
if k2<k3
if walla<balla
result#=k1-k2
else
result#=k1+k2
endif
else
if walla<balla
result#=walla+k3
else
result#=walla-k3
endif
endif
endfunction result#
I have no Idea if it works with dbclassic. I don't have it.