I made a pong game but when i try to make my ball go different directions it does not listen to me and it goes side ways crazy. And for some reason the border does not go across the screen like i want it to. Can someone help me with the code for the ball. I cant seem to get my ball to work right. Thanks.
DBPRO only
Rem Project: Pong
Rem Created: 4/14/2003 3:24:03 PM
Rem ***** Main Source File *****
`Reglar Window
set display mode 800,600,16
set window on
set window size 800,600
set window position 200,250
set window title "Pong V_1.0"
set window layout 0,1,1
`shape maker
xmove#=.4
ymove#=0
`Border
ink rgb(200,100,0),1
box 0,0,25,100
get image 1,0,0,25,100
y1=screen height()/2
y2=screen height()/2
wait 2
xc#=screen width()/2
yc#=screen height()/2
circle 0,0,10
get image 2,0,0,10,10
wait 2
box 0,0,400,20
get image 3,0,0,400,20
sprite 4,0,10,3
sprite 5,400,10,3
wait 2
`main frame of program
do
sprite 1,20,y1,1
sprite 2,750,y2,1
sprite 3,xc#,yc#,2
gosub hit
gosub circlem
gosub controls
loop
controls:
If upkey() then y1=y1+-1
if downkey() then y1=y1+1
if shiftkey() then y2=y2+-1
if controlkey() then y2=y2+1
return
circlem:
xc#=xc#+xmove#
yc#=yc#+ymove#
return
`hit command for the ball
hit:
if sprite collision(3,1) then xmove#=.5
If sprite collision(3,2) then xmove#=-.5
if sprite collision(3,1)
ymove#=.1 or -.1 or -.15 or .15
endif
If sprite collision(3,2)
ymove#=-.1 or .1 or .15 or -.15
endif
return
AMD Atherlon 2400+ XP, 380 DDr memeory, ATI Radeon 9000 64 DDR.
And a Katana.