can someone help me with debuging my pong game there is something wrong with it that only happens sometimes. sometimes the ball gos trough or gets stuck in the redpaddle and when it goes past the red paddle it doesnt count it as a point like when it goes through the green paddle.
rem make paddle ball and floor&color paddles
hide mouse
make object sphere 3,1
make object box 1,1,1,3
position object 1,-5,0,0
make object box 2,1,1,3
position object 2,5,0,0
color object 1,rgb(255,0,0)
color object 2,rgb(0,155,0)
make object box 4,10,0.1,10:position object 4,0,-0.55,0
balla#=90
rem turn sync on and set sync rate to 20
sync on
sync rate 20
rem start the main loop
do
set cursor 300,50:print player1score#
set cursor 320,50:print "-"
set cursor 340,50:print player2score#
if ballx#>6 then player1score#=player1score#+1:ballx#=0:ballz#=0:balla#=270
if ballx#>6 then player2score#=player2score#+1:ballx#=0:ballz#=0:balla#=270
position object 3,ballx#,0,ballz#
yrotate object 3,balla#
ballx#=newxvalue(ballx#,balla#,0.3)
ballz#=newzvalue(ballz#,balla#,0.3)
if ballx#<-4 and ballx#<4.5 and ABS(player1pos#-ballz#)<1.5 then balla#=360-balla#
if ballx#>4 and ABS(player2pos#-ballz#)<1.5 then balla#=360-balla#
if upkey()=1 and ballx#>4 and ballx#<4.5 then balla#=balla#+8
position object 1,-5,0,player1pos#
position object 2,5,0,player2pos#
position camera 0,10,-10
point camera 0,0,0
IF keystate(17)=1 AND player1pos#<5 then player1pos#=player1pos#+0.5
IF keystate(31)=1 AND player1pos#>-5 then player1pos#=player1pos#-0.5
IF upkey()=1 and player2pos#<5 then player2pos#=player2pos#+0.5
IF downkey()=1 and player2pos#>-5 then player2pos#=player2pos#-0.5
sync
loop
Check out my site!(unfinished)
http://www.freewebs.com/dbnewbie/