I've been following Chris K's great sticky tutorial on how to code Pong 3-D, but I'm having some trouble with it near the end.
I can't seem to get the ball to bounce back on the bat, all it does is sort of jumps up and down on the spot next to the bat frantically, can someone show me what I'm doing wrong?
hide mouse
make object box 1,1,1,3:color object 1,rgb(255,0,0)
make object box 2,1,1,3:color object 2,rgb(0,255,0)
make object sphere 3,1:color object 3,rgb(0,0,50)
sync on:do
IF upkey()=1 and player1pos#<5 then player1pos#=player1pos#+0.5
IF downkey()=1 and player1pos#>-5 then player1pos#=player1pos#-0.5
IF keystate(17)=1 and player2pos#<5 then player2pos#=player2pos#+0.5
IF keystate(31)=1 and player2pos#>-5 then player2pos#=player2pos#-0.5
position object 1,5,0,player1pos#:position object 2,-5,0,player2pos#
position camera 0,10,-10:point camera 0,0,0
position object 3,ballx#,0,ballz#
yrotate object 3,balla#
ballx#=newxvalue(ballx#,balla#,0.3)
ballz#=newzvalue(ballz#,balla#,0.3)
balla#=90
if ballx#>4 then balla#=360-balla#
sync:loop
Also, could someone possibly show me how to create a little menu for my Pong game, possibly with a one-player game?
Cheers.