RANDOMIZE Timer() dim vel#(2) DO Select State Case 0 : gosub S0_Init : endcase Case 1 : gosub S1_Prec : endcase Case 2 : gosub S2_Record : endcase Endselect LOOP END S0_Init: Print "Welcome to the BN2 Productions Fling Game!!" Print "Choose Your Game Mode:" Print "1.) Precision: Given a desired distance, enter the correct numbers to make the ball land there" Print "2.) Record: Manipulate the launcher to fire the ball as far as possible" Repeat Input ">",gametype If gametype<1 or gametype>2 print "Please choose a valid response!" Endif Until gametype>0 and gametype<3 state=gametype Return S1_Prec: Cls Dist=rnd(1000)+1 Print "Your goal distance is "+str$(dist)+" meters." Print "Your platform rests 10 meters above the ground" Input "Enter Projectile side platform length>",Psl Input "Enter counter weight side platform length>",Csl ` Input "Enter counter weight mass (kg)>",Mass mass=1 f=mass*10 backdrop on Gosub S1_gen_launch angle=0 wait key repeat RotateBar(psl,csl,wrapvalue(angle)) dec angle alpha#=(f*1.0/mass)/csl van#=sqrt(2*alpha#*abs(angle)) velfinal#=van#*(psl^.6) sync until object collision(3,1)>0 or angle=-90 oldy#=object position y(4) oldx#=object position x(4) sync x=0 repeat sy#=-5*x#^2+velfinal#*sin(abs(angle))*x#+oldy# sx#=velfinal#*cos(abs(angle))*x#+oldx# position object 4,sx#,sy#,5 inc x#,.01 position camera object position x(4),camera position y(),camera position z() sync until object collision(4,1)>0 or object position y(4)<0 backdrop off set text size 24 Center text 320,100,"You went "+str$(sx#+500)+" Meters!" dfd=abs(dist-(sx#+500)) CENTER TEXT 320,120,"Your Accuracy Percentage is "+str$((1-(dfd*1.0/dist))*100)+"%!" sync wait key dumpmedia() cls Return S1_gen_launch: sync on : sync rate 0 Make object box 1,1000,10,10 autocam off Make object box 2,2,10,5 position object 2,-500,10,5 Make object box 3,psl+csl,1,5 make object sphere 4,5 color object 4,rgb(255,0,0) position object 3,object position x(2)+((psl+csl)/2)-psl,object position y(2)+5,object position z(2) color object 2,rgb(255,0,0) color object 3,rgb(0,255,0) position camera object position x(2),object position y(2)+100,object position z(2) move camera -200 sync RETURN S2_Record: Return FUNCTION DumpMedia() FOR I=1 to 65535 IF Sprite Exist(i)=1 then delete sprite i IF Image Exist(i)=1 then delete image i IF Object Exist(i)=1 then delete object i IF I<1025 IF Sound Exist(i)=1 then delete sound i ENDIF IF I<33 IF Music Exist(i)=1 then delete music i ENDIF IF I<32 IF Bitmap Exist(i)=1 then delete bitmap i ENDIF NEXT I ENDFUNCTION function rotateBar(psl,csl,angle#) zrotate object 3,angle# point=((psl+csl)/2)-PSL position object 3,object position x(2)+POINT*cos(angle#),object position y(2)+POINT*sin(angle#)+5,object position z(2) position object 4,object position x(3)-psl*cos(angle#),object position y(3)-psl*sin(angle#),object position z(3) endfunction