here is one way modified a bit from that book game programming for teens
first make a type
;The ball type: for the ball
Type ball
Field x,y,xv,yv ;x, y coordinates, and x, y velocity
End Type
then initialize your values to whatever you want
ball\x = whatever
ball\y = whatever
ball\xv = whatever
ball\xy = whatever
Then in your main loop you will have
DrawImage (ballimage,ball\x,ball\y)
then you will want a checkcollisions function
and in that function you will have something like
if ball\y <= 0 or ball\y >= 600 ;ball hits top or bottom
ball\yv = -ball\yv + rand(-2,2) ;add a little randomness
endif
That book game programming for teams has the full source code for a pong game and I think it is like $60 bucks at Borders
first make a type
;The ball type: for the ball
Type ball
Field x,y,xv,yv ;x, y coordinates, and x, y velocity
End Type
then initialize your values to whatever you want
ball\x = whatever
ball\y = whatever
ball\xv = whatever
ball\xy = whatever
Then in your main loop you will have
DrawImage (ballimage,ball\x,ball\y)
then you will want a checkcollisions function
and in that function you will have something like
if ball\y <= 0 or ball\y >= 600 ;ball hits top or bottom
ball\yv = -ball\yv + rand(-2,2) ;add a little randomness
endif
That book game programming for teams has the full source code for a pong game and I think it is like $60 bucks at Borders