hi guys, can someone help me here:
i have made a pong game that keeps the scores of the player or the AI i want to make it so if the player (player1)score reaches 15 then a black screen comes up saying you won, would you like to play again and if yes then it goes to the game, and if the AI( lpayer 2 in the code)gets 15 then it sas you lost and asks if you would like to play again.
i put this code in here:
Text 450,400,\\\\\\\"Made By Ben Flowers\\\\\\\"
TEXT 70,10,\\\\\\\"You Are the Red Pallet You Must Beat The AI who is the Green Pallet\\\\\\\"
Text 200,130, \\\\\\\"----Controls----\\\\\\\"
Text 200,150, \\\\\\\" UP KEY - Move your Pallet UP\\\\\\\"
Text 200,170,\\\\\\\" Down KEY - Move your Pallet Down\\\\\\\"
Text 200,190,\\\\\\\" Press Escape To Exit\\\\\\\"
ink rgb(255,0,0),1
TEXT 200,220,\\\\\\\" Press Any Key To Continue\\\\\\\"
suspend for key
ink rgb(0,500,0),2
hide mouse
set global collision on
make object plain 4,10,13
xrotate object 4,90
position object 4,0,-0.6,0
color object 4,rgb(0,0,0)
make light 1
make object box 1,1,1,4
color object 1,rgb(255,0,0)
make object box 2,1,1,4
color object 2,rgb(0,255,0)
make object sphere 3,1
sync on
balla#=rnd(360)
game:
do
set light to object position 1,3
if upkey()=1 then player1pos#=player1pos#+0.5 :if player1pos#>=5 then player1pos#=player1pos#-0.5
if downkey()=1 then player1pos#=player1pos#-0.5 :if player1pos#<=-5 then player1pos#=player1pos#+0.5
ballx#=newxvalue(ballx#,balla#,0.35)
ballz#=newzvalue(ballz#,balla#,0.35)
if ballx#>4 and ballx#<4.5 and ABS(player2pos#-ballz#)<=3 then balla#=360-balla#
if ballx#<-4 and ballx#>-4.5 and ABS(player1pos#-ballz#)<=3 then balla#=360-balla#
balla#=wrapvalue(balla#)
if ballz#>=6 then balla#=balla#+240
if ballz#<=-6 then balla#=balla#+240
balla#=wrapvalue(balla#)
if upkey()=1 and ballx#<-4 and ballx#>-4.5 then balla#=balla#+8
if downkey()=1 and ballx#<-4 and ballx#>-4.5 then balla#=balla#-8
if ballz#>player2pos# then inc player2pos#
if ballz#<player2pos then dec player2pos#
if player2pos#>=5 then player2pos#=player2pos#-1
if player2pos#<=-5 then player2pos#=player2pos#+1
p1score#=0
p2score#=0
if ballx#<=-6 then p2score=p2score+1 : ballx#=0:ballz#=0:balla#=rnd(360)
if ballx#>=6 then p1score=p1score+1 : ballx#=0:ballz#=0:balla#=rnd(360)
set cursor 230,50
print p1score
set cursor 300,50
print \\\\\\\"-\\\\\\\"
set cursor 350,50
print p2score
position object 1,-5,0,player1pos#
position object 2,5,0,player2pos#
position object 3,ballx#,0,ballz#
yrotate object 3,balla#
position camera 0,15,-10
xrotate camera 50
balla#=wrapvalue(balla#)
if p1score=15 then goto win
if p2score=15 then goto lose
sync
loop
win:
cls
text 0,200,\\\\\\\"CONGRADULATIONS you won!\\\\\\\"
print \\\\\\\"would you like to play again?\\\\\\\"
input a$
if a$=\\\\\\\"yes\\\\\\\" then goto game
lose:
cls
cls
text 0,200,\\\\\\\"Unlucky you lost this time\\\\\\\"
print \\\\\\\"would you like to play again?\\\\\\\"
input b$
if b$=\\\\\\\"yes\\\\\\\" then end
this doesn\\\\\\\'t work though, it only flashes the writing up for lwess than a scond and the game then freezes looking at the still ball.
any help would be much appreciated,
i also put a copy of the game for download so you can see yourself