Hey!
Can anyone tell me how I can run this simple program in which a ball moves around the screen, and make the movement smooth? Right now it like sometimes seems to go faster, then slower, all in all the movement is definitely not smooth. I've played games in which they had things move much faster, and still it appeared to be smoother.
@Kristopher: I know you're making a breakout game (how's that going on by the way?), so perhaps you can tell me how you handled the ball movement.
Thanks!
Here's the code:
screenres 1280, 800, 24,,1
const dt = .005
dim as double t = 0.0, currentTime, newTime, accumulator, deltaTime
dim as single frames, fps
dim as single bx, by, bvx, bvy
dim as integer br
bx = 500
by = 500
bvx = int(rnd * 300) + 150
bvy = int(rnd * 300) + 150
br = 10
currentTime = timer
accumulator = 0.0
do
newTime = timer
deltaTime = newTime - currentTime
currentTime = newTime
accumulator += deltaTime
while (accumulator>=dt)
bx += bvx * dt
by += bvy * dt
if bvx < 0 and bx - br < 0 then bvx *= -1: bx += bvx*dt
if bvx > 0 and bx + br > 1279 then bvx *= -1: bx += bvx*dt
if bvy < 0 and by - br < 0 then bvy *= -1: by += bvy*dt
if bvy > 0 and by + br > 799 then bvy *= -1:by += bvy*dt
t += dt
accumulator -= dt
wend
screenlock
line (0, 0) - (1279, 799), rgb(20, 20, 80), BF
circle (bx, by), br, rgb(200, 80, 20),,,,F
screenunlock
sleep 1
loop while inkey <> chr(27)
sleep