Sync On Sync Rate 60 color backdrop rgb(0,0,0) Global Dim Ladders(20,3) Gosub _LoadLevels Gosub _LoadLadders Gosub _LoadMiscObjects Gosub _CreateBarrels Gosub _CreateFire Do set cursor 0,0 Print " Lives: "+str$(players) Print " Level: "+str$(difficulty) Print " Score: "+str$(score) Print " HighScore: "+str$(highscore) Print " FPS: "+str$(screen fps()) if players>0 Gosub _GetInput Gosub _UpdateBarrels Gosub _UpdatePlayer Gosub _ScoreAnimation Gosub _UpdateFire if collide=1 then players=players-1:gosub _collision:gosub _StartGame if y#>67 then difficulty=difficulty+1:gosub _startgame else Gosub _Waitingforgame endif Sync Loop _UpdateFire: FireID=600 for I=0 to NumFire if rnd(1000)>970 or fire#(i,1)>-33 then fire#(i,0)=rnd(6)-3:fire#(i,1)=-43:fire#(i,2)=200 position object fireid+I,-50+fire#(i,0),fire#(i,1),0 color object fireid+I,rgb(255,fire#(i,2),0) fire#(i,2)=fire#(i,2)-rnd(1) fire#(i,0)=(fire#(i,0)+((rnd(4)-2)*.03))*.99 if ballhit>0 fire#(i,1)=fire#(i,1)+.15 else fire#(i,1)=fire#(i,1)+.05 endif next I if ballhit>0 then ballhit=ballhit-1 Return _UpdateBarrels: barrelrelease=barrelrelease+1 if barrelrelease>300-30*difficulty if int(rnd(100))>=100-difficulty*5 then barrelrelease=0 endif for i=0 to numbarrels if barrelstatus(i)=1 mintemp#=3 for j=0 to 5 temp#=intersect object (levelid+j,barrel#(i,0),barrel#(i,1),0,barrel#(i,0),barrel#(i,1)-3,0) if temp#>0 and temp#<mintemp# then mintemp#=temp# next j if mintemp#<3 barrel#(i,1)=barrel#(i,1)+(3-mintemp#) barrel#(i,3)=-barrel#(i,3)*.5 else barrel#(i,3)=barrel#(i,3)+.03 endif if barrel#(i,0)>47 then barrel#(i,2)=-barrel#(i,2) if barrel#(i,0)<-57 then barrel#(i,2)=-barrel#(i,2) if barrel#(i,0)<-47 and barrel#(i,1)<-47 then barrelstatus(i)=0:hide object barrelid+i:ballhit=200 barrel#(i,0)=barrel#(i,0)+barrel#(i,2) barrel#(i,1)=barrel#(i,1)-barrel#(i,3) if Ladder(barrel#(i,0),barrel#(i,1)-15) if int(rnd(100))>=100-difficulty barrel#(i,0)=Ladder(barrel#(i,0),barrel#(i,1)-15) barrelstatus(i)=2 barrel#(i,2)=-barrel#(i,2) endif endif if jump=1 and abs(barrel#(i,0)-x#)<2 and y#>barrel#(i,1) and y#-barrel#(i,1)<13 and barrelscored(i)=0 then barrelscored(i)=1:newscore=1 endif if barrelstatus(i)=2 if Ladder(barrel#(i,0),barrel#(i,1)-5)=0 mintemp#=3 for j=0 to 5 temp#=intersect object (levelid+j,barrel#(i,0),barrel#(i,1),0,barrel#(i,0),barrel#(i,1)-3,0) if temp#>0 and temp#<mintemp# then mintemp#=temp# next j if mintemp#<3 barrel#(i,1)=barrel#(i,1)+(3-mintemp#) barrel#(i,3)=0 barrelstatus(i)=1 endif endif if barrelstatus(i)=2 then barrel#(i,1)=barrel#(i,1)-.5 endif if barrelstatus(i)=0 and barrelrelease=0 barrelrelease=1 barrelstatus(i)=1 barrel#(i,0)=-45 barrel#(i,1)=60 barrel#(i,2)=.4 barrel#(i,3)=0 show object barrelid+i endif if barrelstatus(i)<>0 position object barrelid+i,barrel#(i,0),barrel#(i,1),0 if (x#-barrel#(i,0))*(x#-barrel#(i,0))+(y#-barrel#(i,1))*(y#-barrel#(i,1))<16 then collide=1 endif next Return _ScoreAnimation: if scoreanimation>0 set cursor scorex#,scorey# print tempscore scorey#=scorey#-.3 scoreanimation=scoreanimation-1 endif return _jumpscore: if newscore=1 tempscore=0 for i=0 to numbarrels if barrelscored(i)=1 then tempscore=tempscore+1 barrelscored(i)=0 next i tempscore=2^tempscore*100 if tempscore>0 score=score+tempscore scorex#=object screen x(1):scorey#=object screen y(1):scoreanimation=100 endif newscore=0 endif Return _collision: ghost object on 1 for i=0 to 270 step 1 rotate object 1,0,0,i position object 1,x#,y#,0 sync next i rotate object 1,0,0,0 ghost object off 1 Return _CreateBarrels: Barrelid=200 numbarrels=30 dim barrel#(numbarrels,3) dim barrelstatus(numbarrels) dim barrelscored(numbarrels) for i=0 to numbarrels make object sphere barrelid+i,6 color object barrelid+i,rgb(206,126,47) hide object barrelid+i barrel#(i,0)=-45 barrel#(i,1)=60 barrel#(i,2)=.2 barrel#(i,3)=0 barrelstatus(numbarrels)=0 next i Return _UpdatePlayer: mintemp#=2 for j=0 to 5 temp#=intersect object (levelid+j,x#,y#-2,0,x#,y#-4,0) if temp#>0 and temp#<mintemp# then mintemp#=temp# next j if mintemp#<2 onground=1:jump=0:gosub _jumpscore `if (2-mintemp#)>1 then climbing=0 if climbing=0 then y#=y#+(2-mintemp#) ym#=0 else onground=0 ym#=ym#+.03 if ym#>.06 then onground=0 endif if climbing=1 and ym#>0 then ym#=0:jump=0:gosub _jumpscore y#=y#-ym# if x#>47 then x#=46:xm#=-xm# if x#<-57 then x#=-56:xm#=-xm# x#=x#+xm# position object 1,x#,y#,0 camx#=camx#*.985+x#*.015 camy#=camy#*.985+y#*.015 camz#=camz#*.98+(-50)*.02 position camera camx#,camy#,camz# point camera x#,y#,0 Return _GetInput: onladder#=ladder(x#,y#-4) onladder2#=ladder(x#,y#-3) K_up=upkey() K_down=downkey() K_left=leftkey() K_right=rightkey() K_space=spacekey() if K_up=1 and jump=0 and onladder2#<>0 then climbing=1:y#=y#+.15:xm#=0:x#=onladder2# if K_down=1 and jump=0 and onladder#<>0 then climbing=1:y#=y#-.15:xm#=0:x#=onladder# if onground=1 then xm#=0 if K_left=1 and onground=1 then xm#=-.35:climbing=0 if K_right=1 and onground=1 then xm#=.35:climbing=0 if K_space=1 and onground=1 then ym#=-.63:y#=y#+1:jump=1:climbing=0 Return _Waitingforgame: if score>highscore then highscore=score score=0 players=3 difficulty=1 Gosub _StartGame Return _StartGame: collide=0 camx#=5000 camz#=-20000 camy#=0 camxm#=0 camym#=0 camzm#=0 ss#=10 x#=-40 y#=-48 xm#=0 ym#=0 for i=0 to numbarrels hide object barrelid+i barrelstatus(i)=0 next i Return _LoadLevels: Levelid=100 for I=0 to 8 read sizex,sizey,posx,posy,angle# make object box Levelid+i,sizex,sizey,10 position object Levelid+i,posx,posy,0 rotate object Levelid+i,0,0,angle# color object Levelid+i,rgb(255,0,0) next i data 110,2,-5,-50,3 data 100,2,-10,-30,-3 data 100,2,0,-10,3 data 100,2,-10,10,-3 data 100,2,0,30,3 data 100,2,-10,50,-3 data 40,2,-20,70,0 data 2,120,-60,0,0 data 2,120,50,0,0 Return _LoadLadders: ladderid=400 for i=0 to 18 read sizey,posx,posy ladders(i,0)=posx-2 ladders(i,1)=posy+(sizey*.5) ladders(i,2)=posx+2 ladders(i,3)=posy-(sizey*.5) make object box Ladderid+i,4,sizey,1 position object Ladderid+i,posx,posy,3 color object Ladderid+i,rgb(255,255,0) next i data 6,-25,-48,10,-25,-33,16,35,-39 data 18,-43,-21,22,1,-20 data 20,8,1,7,-20,-8,11,-20,7 data 18,33,0,10,13,14,10,13,27 data 21,-14,21,17,-45,21,9,-9,35 data 9,-9,47,17,30,41,23,-4,62 data 50,-41,77,50,-56,77 Return _LoadMiscObjects: make object box 1,4,8,4 position object 1,-40,-48,0 make object cylinder 300,10 color object 300,rgb(0,0,255) position object 300,-50,-48,0 Return Function Ladder(tempx#,tempy#) onladderval#=0 for i=0 to 19 if tempx#>=ladders(i,0) and tempx#<=ladders(i,2) and tempy#<=ladders(i,1) and tempy#>=ladders(i,3) then onladderval#=(ladders(i,0)+ladders(i,2))*.5 next i EndFunction onladderval# _CreateFire: FireID=600 NumFire=250 Dim Fire#(numfire,2) for I=0 to NumFire `Make object sphere fireid+I,1.5 Make object plain fireid+I,1,1 rotate object fireid+I,rnd(360),rnd(360),0 color object fireid+I,rgb(255,0,0) fire#(i,0)=0:fire#(i,1)=-43:fire#(i,2)=0 ghost object on fireid+I position object fireid+I,-50,-43,0 next I Return