Hi guys - i took the pong game written as a tutorial and wanted to edit it. I got this far:
set display mode 1024,768,32
rem hides the mouse
hide mouse
rem makes the refresh rate 40
sync rate 40
rem makes both the paddles - the ball and the table
make object box 1,1,2,3:color object 1,rgb(255,0,0)
make object box 2,1,2,3:color object 2,rgb(0,255,0)
make object sphere 3,1:color object 3,rgb(0,0,50)
make object box 4,60,0.1,35:position object 4,0,-0.55,0
rem makes the starting angle of the ball at 70 degrees
balla#=70
rem starts the main loop and insures vsync is on
sync on:do
rem the scoring code if the ball is past the bat then its +1 to the score and the creation of the scoreboard
if ballx#>29 then player2score#=player2score#+1:ballx#=0:ballz#=0:balla#=270
if ballx#<-29 then player1score#=player1score#+1:ballx#=0:ballz#=0:balla#=90
set cursor 300,50:print player2score#
set cursor 320,50:print "-"
set cursor 340,50:print player1score#
rem making the ball move forwards all the time at the angle is travelling at
ballx#=newxvalue(ballx#,balla#,0.3):ballz#=newzvalue(ballz#,balla#,0.3)
rem paddle 1 movement - up and down keys - whilst limiting its area of movement
IF upkey()=1 and player1pos#<15.9 then player1pos#=player1pos# +0.5
IF downkey()=1 and player1pos#>-15.9 then player1pos#=player1pos# -0.5
if upkey()=1 and ballx#>30 and ballx#<30 then balla#=balla#+8
if downkey()=1 and ballx#>30 and ballx#<30 then balla#=balla#-8
rem paddle 2 movement - up and down keys - whilst limiting its area of movement
IF keystate(17)=1 and player2pos#<15.9 then player2pos#=player2pos#+0.5
IF keystate(31)=1 and player2pos#>-15.9 then player2pos#=player2pos#-0.5
if keystate(17)=1 and ballx#<-4 and ballx#>-4.5 then balla#=balla#+8
if keystate(31)=1 and ballx#<-4 and ballx#>-4.5 then balla#=balla#-8
rem the balls bouncing movement if it hits the paddles
if ballx#>4 and ballx#<4.5 and ABS(player1pos#-ballz#)<1.5 then balla#=360-balla#
if ballx#<-4 and ballx#>-4.5 and ABS(player2pos#-ballz#)<1.5 then balla#=360-balla#
if ballz#>4 or ballz#<-4 then balla#=180-balla#
rem verification that the angle of the ball is between 0 and 360 or problems arise
balla#=wrapvalue(balla#)
rem the positioning of all the objects - player 1 paddle, player 2 paddle, the ball, and finally the camera
position object 1,29,0,player1pos#:position object 2,-29,0,player2pos#
position object 3,ballx#,0,ballz#:yrotate object 3,balla#
position camera 0,50,-10:point camera 0,0,0
rem verification that vsync is still running and the code for the end of a loop
sync:loop
Try running that - its easy to see there is a problem with scoring and the ball's physics - its bouncing where it used to - before i made the board bigger. So which number do i edit this to sort it out - its been bugging me for a while and i cannot work it out!
Thanks in advance for any help!
NO KEYBOARD DETECED - PRESS F11 TO CONTINUE - FOOKED BIOS