Update: v1.2: Fixed a few bugs (specifically, estimated deaths value decreases as it should after completing the 1st level - it used to increase). Fire rate remains constant now instead of slowing down. Meteors stay in an area instead of flying off all over the place, making for a boring chase down. Meteors are much larger and easier to hit, but are tougher and take more shots to destroy.
Edit: Slight adjustments to v1.2/Fixed the containment code. Meteors will now stay in bounds. Ship can move slightly faster. Bullets fly slightly faster.
`Collision Course by RiiDii
Print "The year is 2063...":Print "10,000,000,000 people now inhabit the earth!":Print "A large meteor is heading on a direct course with the planet!":Print "Everyone... Every single person... will die!":Print:Print "Unless you can save them!":Print "You have an advanced fighter developed for space flight,":Print "equipped with shields and high-velocity gauss cannons.":Print "The meteor will likely break apart into pieces as you shoot it.":Print "You must destroy as many pieces before they reach the earth!":Print:Print "Destroy the larger pieces first as they will cause the most damage!":Wait Key:Sync On:Sync Rate 60:Autocam Off:Set Camera Range 5,15000:Dim Meteor(100,7) as Float:Global people as Integer:Global shields as Integer:Global timeleft as integer:StarSkyBox:For i = 2 to 3:Make Object Cylinder i,1
Scale Object i,150,500,100:Color Object i,rgb(150,150,150):Set Object Emissive i,rgb(20,20,100):Pitch Object Down i,90:Fix Object Pivot i:Next i:Make Object Cube 1,20:Position Object 2,10,-5,13:Position Object 3,-10,-5,13:Make Object Cone 5,4:Scale Object 5,100,200,100:Ghost Object On 5:Color Object 5,Rgb(255,0,0):Set Object Cull 5,0:Global diff#=.4:Do:people=1000:shields=1000:timeleft=1000:
New_Meteor(300,0,0,600):t=Timer():b=2:bt=Timer():Do:Set Cursor 0,0:Print "Press any key to start"
If inkey$()<>"":Exit:Endif:Sync:Loop:Do:Turn Object Right 1,MouseMoveX()*.2:Pitch Object Down 1,MouseMoveY()*.2:Move object 1,(Upkey()-DownKey())*8:For i=2 to 3:Position Object i,Object Position X(1),Object Position Y(1),Object Position Z(1):Set Object To Object Orientation i,1:Move Object Down i,5:Move Object i,12:Next i:Move Object Right 2,10:Move Object Left 3,10:Position Camera Object Position X(1),Object Position Y(1),Object Position Z(1):Set Camera To Object Orientation 1:Position Object 4,Object Position X(1),Object Position Y(1),Object Position Z(1):If MouseClick()=1 and Timer()-bt>100:Make_Bullet(b):b=b+(b=2)-(b=3):bt=Timer()
Endif:pitch object down 2,90:pitch object down 3,90:Move_Bullet():Meteor_Moves():Set Cursor 0,0:Print "Estimated deaths: ";people;"000000":Print "Time until impact: ";timeleft-((timer()-t)/1000):Print "Shields: ";shields:If shields<1 or (timeleft-((timer()-t)/1000))<1 or people<1:Exit:Endif:Position Mouse Screen Width()/2,Screen Height()/2:Sync:Loop:Do:Set Cursor 0,0:if people<1:Print "Congratulations!!! You saved the planet!":Print "Any remaning debree will fly off into space, break up":Print "on entry, or be handled by Earth's defenses.":Print "You return to Earth and receive a hero's welcome!":Print "Your name will be remembered for thousands of years!":
Else:Print "Esitmated deaths :";people:Print "You have been brave in you efforts, but it was not enough.":Print "When you return to Earth, you discover the devistation has":Print "hit close to home. You receive a hero's welcome, but the":Print "destruction overshadows the somber celibration.":Print "You ask yourself, "could I have done better?"":diff#=.42:Endif:Print:Print "Shields: ";shields:Print:Print:Print "Press any key to play again.":If inkey$()<>"":Exit:Endif:Sync:Loop:For i = 1 to 100:If Object Exist(i+10):Delete Object i+10:Endif:meteor(i,0)=0:meteor(i,7)=0:Next i:Position Object 1,0,0,0:diff#=diff#-.02:Loop
Function Meteor_Moves():For i = 1 to 100:If Meteor(i,0)>0:Bounce(i):Position Object i+10,Object Position X(10+i)+Meteor(i,1),Object Position Y(10+i)+Meteor(i,2),Object Position Z(10+i)+Meteor(i,3):Turn Object Left 10+i,Meteor(i,4):Pitch Object Down 10+i,Meteor(i,5):Roll Object Right 10+i,Meteor(i,6):Position Object 5,Object Position X(1),Object Position Y(1),Object Position Z(1):Point Object 5,Object Position X(i+10),Object Position Y(i+10),Object Position Z(i+10):Move Object 5,15:Pitch Object Down 5,90:If Object Collision(i+10,1)>0:dec shields,Meteor(i,0)*10:Meteor(i,0)=0:If Meteor(i,0)<1:Hide Object i+10:Set Object Collision Off i+10:Endif:Endif:Else:If Object Exist(i+10):x#=Object Position X(i+10):y#=Object Position Y(i+10):z#=Object Position Z(i+10):s#=Meteor(i,7)-30
Delete Object i+10:if s#>5:New_Meteor(s#,x#,y#,z#):New_Meteor(s#,x#,y#,z#):Endif:People=People-(s#*diff#/3):Endif:Endif:Next i
Endfunction:Function New_Meteor(size#,x#,y#,z#):For j = 1 to 100:If Object Exist(j+10)=0:Exit:Endif:Next j:if j>100:ExitFunction:Endif:Make_Object_Rock(j+10,size#,.1):Set Object Collision To Boxes j+10:Position Object j+10,x#,y#,z#:Meteor(j,0)=size#/10:Meteor(j,1)=(rnd(800.0)/100.0)-4.0:Meteor(j,2)=(rnd(800.0)/100.0)-4.0:Meteor(j,3)=(rnd(800.0)/100.0)-4.0:Meteor(j,4)=(rnd(400.0)/100.0)-2.0:Meteor(j,5)=(rnd(400.0)/100.0)-2.0:Meteor(j,6)=(rnd(400.0)/100.0)-2.0:Meteor(j,7)=size#
EndFunction:Function Make_Object_Rock(ObjectID,Size#,Roughness#):dim VA(3):Make Object Sphere ObjectID,Size#,8,8:Color Object ObjectID,RGB(84,54,61):Set Object Cull ObjectID,0:for A=0 to 150:LOCK VERTEXDATA FOR LIMB ObjectID, 0:e=Get VertexData Index Count()-1:for I=3 to e-3 step 3:VA(0)=GET INDEXDATA(I+0):VA(1)=GET INDEXDATA(I+1):VA(2)=GET INDEXDATA(I+2):for VI=0 to 2:V=VA(VI):X#=GET VERTEXDATA POSITION X(V)+(Rnd(20.0)-10.0)/(10.0/Roughness#/(Size#/20.0)):Y#=GET VERTEXDATA POSITION Y(V)+(Rnd(20.0)-10.0)/(10.0/Roughness#/(Size#/20.0)):Z#=GET VERTEXDATA POSITION Z(V)+(Rnd(20.0)-10.0)/(10.0/Roughness#/(Size#/20.0)):SET VERTEXDATA POSITION V, X#, Y#, Z#:next VI:next I:UNLOCK VERTEXDATA:next A
EndFunction:Function Make_Bullet(gun):For i = 201 to 230:If Object Exist(i)=0:If Object Exist(i+1):Delete Object i+1:Endif:If i=230 and Object Exist(201):Delete Object 201:Endif:Exit:Endif:Next i:Make Object Sphere i,1,5,5:Scale Object i,100,80,200:Set Object Collision To Boxes i:Color Object i,rgb(50,50,255):Set Object Emissive i,rgb(0,0,100):Position Object i,Object Position X(gun),Object Position Y(gun),Object Position Z(gun):Set Object To Object Orientation i,gun
Endfunction:Function Move_Bullet():For i = 201 to 230:If Object exist(i):for j=1 to 10:If Object exist(i):Move object i,2:oc=Object Collision (i,0):If oc>10:dec Meteor(oc-10,0):If Meteor(oc-10,0)<1:Hide Object oc:Set Object Collision Off oc:Endif:Delete Object i:Endif:Endif:Next j:Endif:Next i
Endfunction
#Constant StarSkyBox :If Bitmap Exist(1):Delete Bitmap 1:Endif:Create Bitmap 1,1024,1024:Box 0,0,1023,1023,0,0,0,0:For i = 1 to 500+rnd(500)+rnd(500)+Rnd(500):Dot Rnd(1023),Rnd(1023),Rgb(255,255,255):Next i:Get Image 4,0,0,1023,1023:Set Current Bitmap 0:Make Object Cube 4,-10000:Texture Object 4,4:Set Object Emissive 4,Rgb(255,0,0):set Object Light 4,0:Delete Bitmap 1
Function Bounce(m):If abs(Object Position X(m+10))>2000:Meteor(m,1)=-1*Meteor(m,1):Endif:If abs(Object Position Y(m+10))>2000: Meteor(m,2)=-Meteor(m,2):Endif:If abs(Object Position Z(m+10))>2000:Meteor(m,3)=-1*Meteor(m,3):Endif
EndFunction
"Droids don't rip your arms off when they lose." -H. Solo
REALITY II