Quote: " @Chris K: erm it shouldn't come out as 0.000000008, because he only used integer numbers."
Although he uses integer numbers to position the ball, he doesn't use integers to display the results of the sin and cos function.
t$ = "cos deg: " + str$(cos(deg))
text 0,20,t$
cos() returns a float value, str$() converts this float to a string (no integers used).
But the main problem of this example is the fact that he uses integer variables to store the results of the sin and cos functions.
sync on
sync rate 60
hide mouse
ink rgb(255,255,255),0
ballx#=320
bally#=240
deg=50
ballspeed=2
batx=320
batspeed=5
do
`the ball
if bally#<10
if deg>=0 and deg<90 then deg=180-deg
if deg>270 and deg<360 then deg=180+(360-deg)
endif
if ballx#>610 or ballx#<10 then deg=360-deg
ballx#=ballx#+sin(deg)*ballspeed
bally#=bally#-cos(deg)*ballspeed
circle ballx#,bally#,10
`the bat
if leftkey() then batx=batx-batspeed
if rightkey() then batx=batx+batspeed
box batx-40,430,batx+40,440
`diagnostics
t$ = "deg: " + str$(deg)
text 0,0,t$
t$ = "sin deg: " + str$(sin(deg))
text 0,10,t$
t$ = "cos deg: " + str$(cos(deg))
text 0,20,t$
sync
cls
loop