yo. i am modding somone elses (cant remember whos) code cause im a total noob.
so im understanding it and all. but for some reason when it says
if player1score#=10 then gosub start1
if player2score#=10 then gosub start1
the game just stops and freazes. even if i use the return command.
here is the code im using:
START1:
`LOAD PRE-GAME STUFF
load image "plank.jpg",1
load image "metal.jpg",2
load image "mallet.jpg",3
paste image 3,230,140
color backdrop rgb (0,0,0)
load sound "button1.wav",1
gosub MAIN_START
MAIN_START:
Do
set text font "arial"
set text size 30
Button(50,50,"1 Player Difficulty:")
set text size 12
if Button(50,90,">EASY<")=1 then gosub New_game_1_player_EASY
if Button(50,120,">HARD<")=1 then gosub New_game_1_player_HARD
set text size 30
if Button(400,50,"- Rival Mode -")=1 then gosub New_game_2_player
loop
New_Game_1_player_EASY:
cls
set text size 30
set cursor 190,230
print "Please Wait..."
wait 1500
gosub START_1PLR_EASY
New_Game_1_player_HARD:
cls
set text size 30
set cursor 190,230
print "Please Wait..."
wait 1500
gosub START_1PLR_HARD
New_Game_2_player:
cls
set text size 16
input "Type in player 1's name:" , name$
input "Type in player 2's name:" , names$
print "Press any button to continue"
wait key
print "Please Wait..."
wait 2000
gosub START_2PLR
function Button(x1,y1,WORDS$)
Pressed=0
x2=Text Width(WORDS$)
y2=Text Height(WORDS$)
if mousex()>x1 and mousex()<x1+x2
if mousey()>y1-y2 and mousey()<y1+y2
Pressed=1
endif
endif
if pressed=1 then ink rgb(255,0,0),0 else ink rgb(150,55,55),0
if pressed=1
Pressed=Mouseclick()
set sound volume 1,100
play sound 1
else
pressed = 0
endif
text x1,y1,WORDS$
endfunction pressed
START_1PLR_HARD:
rem HIDE THE MOUSE AND LIMIT THE SYNC RATE TO 40
hide mouse:sync rate 20
`PLayer 1
make object box 1,1,1,3:texture object 1,2
`Player 2
make object box 2,1,1,3:texture object 2,2
`Ball
make object sphere 3,1
`Table top
make object box 4,19.5,0.1,0.4:color object 4,rgb(255,255,255)
make object box 5,19.5,0.1,0.2:color object 5,rgb(255,255,255)
make object box 6,20,0.1,21:color object 6,rgb(0,85,0)
make object box 7,0.2,0.1,20:color object 7,rgb(255,255,255)
Make object box 9,1,10,1
Make object box 10,1,10,1
texture object 6,1
texture object 9,1
texture object 10,1
texture object 3,2
Balla#=60
rem SET THE BALL ANGLE TO 90 DEGREES
balla#=500
rem START THE MAIN LOOP
Serve = rnd(1)+1
if serve = 1
balla# = 45+rnd(60)
else
balla# = 225+rnd(60)
endif
Hide Mouse
sync rate 40
color backdrop rgb (0,0,0)
`Main Loop
Sync on
do
set ambient light 50
`Mis.
set text size 20
set cursor 200,30:print names$
set cursor 300,50:print player2score#
set cursor 320,50:print "-"
set cursor 340,50:print player1score#
set cursor 355,30:print name$
`Scoring
if ballx#>9.5 then player2score#=player2score#+1:ballx#=0:ballz#=0:balla#=270
if ballx#<-9.5 then player1score#=player1score#+1:ballx#=0:Ballz#=0:balla#=90
`IF END
if player1score#=10 then gosub start1
if player2score#=10 then gosub start1
`Ball movment
Ballx#=newxvalue(ballx#,balla#,0.35)
Ballz#=newzvalue(ballz#,balla#,0.35)
`Player 1 Contols
IF upkey()=1 and player1pos#<10 then player1pos#=player1pos#+1.0
IF downkey()=1 and player1pos#>-10 then player1pos#=player1pos#-1.0
IF upkey()=1 and Ballx#>9 and ballx#<9.5 then balla#=Balla#+8
If downkey()=1 and ballx#>9 and Ballx#<9.5 then balla#=Balla#-8
`AI
if ballz#>player2pos# then player2pos#=player2pos#+0.07
if ballz#<player2pos# then player2pos#=player2pos#-0.07
`Ball Mis.
if ballx#>9 and Ballx#<9.5 and ABS(player1pos#-ballz#)<3.5 then balla#=360-Balla#
if ballx#<-9 and ballx#>-9.5 and ABS(player2pos#-ballz#)<3.5 then balla#=360-balla#
If ballz#>9 or Ballz#<-9 then balla#=180-balla#
balla#=wrapvalue(balla#)
`Positions
position object 1,10,0,player1pos#
position object 2,-10,0,player2pos#
position object 3,ballx#,0,ballz#
yrotate object 3,balla#
position object 4,0,0,10
position object 5,0,0,-10
position object 6,0,-0.55,0.5
position object 9,-9.5,-5.55,-9.5
position object 10,9.5,-5.55,-9.5
`Camera
position camera 0,20,-20:point camera 0,0,0
`end loop
sync
loop
remstart
---------------------------------------------------------
---------------------------------------------------------
---------------------LEVEL1-EASY-------------------------
---------------------------------------------------------
---------------------------------------------------------
remend
START_1PLR_EASY:
rem HIDE THE MOUSE AND LIMIT THE SYNC RATE TO 40
hide mouse:sync rate 40
Balla#=60
rem SET THE BALL ANGLE TO 90 DEGREES
balla#=500
rem START THE MAIN LOOP
Serve = rnd(1)+1
if serve = 1
balla# = 45+rnd(60)
else
balla# = 225+rnd(60)
endif
`PLayer 1
make object box 1,1,1,3:texture object 1,2
`Player 2
make object box 2,1,1,3:texture object 2,2
`Ball
make object sphere 3,1
`Table top
make object box 4,19.5,0.1,0.4:color object 4,rgb(255,255,255)
make object box 5,19.5,0.1,0.2:color object 5,rgb(255,255,255)
make object box 6,20,0.1,21:color object 6,rgb(0,85,0)
make object box 7,0.2,0.1,20:color object 7,rgb(255,255,255)
Make object box 9,1,10,1
Make object box 10,1,10,1
texture object 6,1
texture object 9,1
texture object 10,1
texture object 3,2
Hide Mouse
sync rate 40
color backdrop rgb (0,0,0)
`Main Loop
Sync on
do
set ambient light 50
`Mis.
set text size 20
set cursor 200,30:print names$
set cursor 300,50:print player2score#
set cursor 320,50:print "-"
set cursor 340,50:print player1score#
set cursor 355,30:print name$
`Scoring
if ballx#>9.5 then player2score#=player2score#+1:ballx#=0:ballz#=0:balla#=270
if ballx#<-9.5 then player1score#=player1score#+1:ballx#=0:Ballz#=0:balla#=90
`IF END
if player1score#=10 then gosub start1
if player2score#=10 then gosub start1
`Ball movment
Ballx#=newxvalue(ballx#,balla#,0.35)
Ballz#=newzvalue(ballz#,balla#,0.35)
`Player 1 Contols
IF upkey()=1 and player1pos#<10 then player1pos#=player1pos#+1.0
IF downkey()=1 and player1pos#>-10 then player1pos#=player1pos#-1.0
IF upkey()=1 and Ballx#>9 and ballx#<9.5 then balla#=Balla#+8
If downkey()=1 and ballx#>9 and Ballx#<9.5 then balla#=Balla#-8
`AI
if ballz#>player2pos# then player2pos#=player2pos#+0.02
if ballz#<player2pos# then player2pos#=player2pos#-0.02
`Ball Mis.
if ballx#>9 and Ballx#<9.5 and ABS(player1pos#-ballz#)<3.5 then balla#=360-Balla#
if ballx#<-9 and ballx#>-9.5 and ABS(player2pos#-ballz#)<3.5 then balla#=360-balla#
If ballz#>9 or Ballz#<-9 then balla#=180-balla#
balla#=wrapvalue(balla#)
`Positions
position object 1,10,0,player1pos#
position object 2,-10,0,player2pos#
position object 3,ballx#,0,ballz#
yrotate object 3,balla#
position object 4,0,0,10
position object 5,0,0,-10
position object 6,0,-0.55,0.5
position object 9,-9.5,-5.55,-9.5
position object 10,9.5,-5.55,-9.5
`Camera
position camera 0,20,-20:point camera 0,0,0
`end loop
sync
loop
START_2PLR:
`PLayer 1
make object box 1,1,1,3:texture object 1,2
`Player 2
make object box 2,1,1,3:texture object 2,2
`Ball
make object sphere 3,1
`Table top
make object box 4,19.5,0.1,0.4:color object 4,rgb(255,255,255)
make object box 5,19.5,0.1,0.2:color object 5,rgb(255,255,255)
make object box 6,20,0.1,21:color object 6,rgb(0,85,0)
make object box 7,0.2,0.1,20:color object 7,rgb(255,255,255)
Make object box 9,1,10,1
Make object box 10,1,10,1
texture object 6,1
texture object 9,1
texture object 10,1
texture object 3,2
rem HIDE THE MOUSE AND LIMIT THE SYNC RATE TO 40
hide mouse:sync rate 40
Balla#=60
rem SET THE BALL ANGLE TO 90 DEGREES
balla#=90
rem START THE MAIN LOOP
Hide Mouse
sync rate 40
color backdrop rgb (0,0,0)
Serve = rnd(1)+1
if serve = 1
balla# = 45+rnd(60)
else
balla# = 225+rnd(60)
endif
`Main Loop
Sync on
do
set ambient light 50
`Mis.
set text size 20
set cursor 200,30:print names$
set cursor 300,50:print player2score#
set cursor 320,50:print "-"
set cursor 340,50:print player1score#
set cursor 400,30:print name$
`Scoring
if ballx#>9.5 then player2score#=player2score#+1:ballx#=0:ballz#=0:balla#=270
if ballx#<-9.5 then player1score#=player1score#+1:ballx#=0:Ballz#=0:balla#=90
`Ball movment
Ballx#=newxvalue(ballx#,balla#,0.35)
Ballz#=newzvalue(ballz#,balla#,0.35)
`Player 1 Contols
IF upkey()=1 and player1pos#<10 then player1pos#=player1pos#+1.0
IF downkey()=1 and player1pos#>-10 then player1pos#=player1pos#-1.0
IF upkey()=1 and Ballx#>9 and ballx#<9.5 then balla#=Balla#+8
If downkey()=1 and ballx#>9 and Ballx#<9.5 then balla#=Balla#-8
`Player 2 Controls
IF keystate(17)=1 and player2pos#<10 then player2pos#=player2pos#+1.0
IF keystate(31)=1 and player2pos#>-10 then player2pos#=player2pos#-1.0
IF keystate(17)=1 and Ballx#<-9 and ballx#>9.5 then balla#=balla#+8
IF keystate(31)=1 and Ballx#<-9 and Ballx#>9.5 then balla#=balla#-8
`Ball Mis.
if ballx#>9 and Ballx#<9.5 and ABS(player1pos#-ballz#)<3.5 then balla#=360-Balla#
if ballx#<-9 and ballx#>-9.5 and ABS(player2pos#-ballz#)<3.5 then balla#=360-balla#
If ballz#>9 or Ballz#<-9 then balla#=180-balla#
balla#=wrapvalue(balla#)
`Positions
position object 1,10,0,player1pos#
position object 2,-10,0,player2pos#
position object 3,ballx#,0,ballz#
yrotate object 3,balla#
position object 4,0,0,10
position object 5,0,0,-10
position object 6,0,-0.55,0.5
position object 9,-9.5,-5.55,-9.5
position object 10,9.5,-5.55,-9.5
`Camera
position camera 0,20,-20:point camera 0,0,0
`end loop
sync
loop
please help,
thanks,
-Marlin Studios