When you inc your positions you first need to declear them, you did not do this, but here is a real good example pong game already set up from me dong a search.You can learn just from looking at the code. Also you should do it with sprites so all you need to do is move the sprite and not incress any positions.just make a sprite out of the ball you drew like in this demo project.
Rem Project: Pong
Rem Created: 28/11/2002 20:07:19
Rem ***** Main Source File *****
rem draw bats and ball
box 0,0,10,30
get image 1,0,0,8,8 rem--he got image here to use the image he created from the box he made
get image 2,0,0,10,30
rem set sync rate
sync rate 60
sync on
rem initiate ball sprite
sprite 1,0,0,1 rem here he made a sprite out of the first get image he made from the box he created
rem set bats to default positions
bat1_y=220
bat2_y=220
rem player first to serve
serve=1
gosub serve
do
rem draw borders
box 0,15,640,25
box 0,470,640,480
rem display scores
text 0,0,"Player score: "+str$(score1)
text 200,0,"Cpu score: "+str$(score2)
rem player control
if keystate(30)=1 then dec bat1_y,6
if keystate(44)=1 then inc bat1_y,6
if bat1_y<25 then bat1_y=25
if bat1_y>440 then bat1_y=440
rem ai
if sprite angle(1)<180 and sprite x(1)>100
if sprite y(1)>bat2_y then inc bat2_Y,6
if sprite y(1)<bat2_y then dec bat2_Y,6
if bat2_y<25 then bat2_y=25
if bat2_y>440 then bat2_y=440
endif
rem here he is moving the said ball he created
rem move ball
move sprite 1,7
rem move bats
sprite 2,10,bat1_y,2
sprite 3,620,bat2_y,2
rem ball to bat deflection
if sprite collision(1,2)=1 or sprite collision(1,3)=1
ang=wrapvalue(sprite angle(1)+rnd(90)+90)
rotate sprite 1,ang
endif
rem ball to wall deflection
if sprite y(1)>462
ang=wrapvalue(180-sprite angle(1))
rotate sprite 1,ang
endif
if sprite y(1)<25
ang=wrapvalue(180-sprite angle(1))
rotate sprite 1,ang
endif
rem ball out detection
if sprite x(1)>640
serve=1
gosub serve
inc score1
endif
if sprite x(1)<0
serve=2
gosub serve
inc score2
endif
sync
loop
serve:
if serve=1
x=25
ang=rnd(90)+45
endif
if serve=2
x=615
ang=rnd(90)+225
endif
y=rnd(380)+50
sprite 1,x,y,1
rotate sprite 1,ang
return
my signature keeps being erased by a mod So this is my new signature.