Asteroids on steroids! `Nuf said.

Enjoy!
`Collision Course II by RiiDii
Load Image "Bump034.bmp",1,1:Load 3DSound "Gun 5.wav",1:Load Sound "Large explosion 1.wav",2:Hide Light 0: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,30000:Dim Meteor(100,7) as Float:Global people as Integer:Global shields as Integer:Global timeleft as integer
Global Score as DWord:Dim center(2) as Float:Dim acc(2) as Float:dim es(10) as Float:dim VA(3):StarSkyBox:Score=0: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:Global diff#=.4:Do:people=1000:shields=1000:timeleft=1000:New_Meteor(1000,500,Rnd(200)-100,1500):t=Timer()
b=2:bt=Timer():Do:Set Cursor 0,0:Print "Press any key to start":If scancode()>0:Exit:Endif:Sync:Loop:If Bitmap Exist(1):Delete Bitmap 1:Endif:sw=Screen Width():sh=Screen Height():Create Bitmap 1,sw,sh:Ink rgb(255,0,0),0:Box 0,0,sw-1,sh-1:Set Text Size 60:Set Text Font "ARIEL":Set Text To Bold:Ink RGB(0,0,128),0:Center Text sw/2,50,"PROXIMITY":Center Text sw/2,130,"ALERT!!!":Set Text To Normal
Set Text Size 16:Get Image 2,0,0,sw-1,sh-1,1:Set Current bitmap 0:Delete Bitmap 1:Ink Rgb(255,255,255),0:Sprite 2,0,0,2:Set Sprite Alpha 2,35:Hide Sprite 2:Do:Turn Object Right 1,MouseMoveX()*.2:Pitch Object Down 1,MouseMoveY()*.2:Roll Object Left 1,LeftKey()-RightKey()*.2:Position Object 1,Object Position X(1)+acc(0),Object Position Y(1)+acc(1),Object Position Z(1)+acc(2):For i= 0 to 2:acc(i)=acc(i)*.97:Next i:if upkey() or Downkey():Move Object 1,.1*(Upkey()-DownKey()):x2#=Object Position X(1):y2#=Object Position Y(1):z2#=Object Position Z(1):Move Object 1,-.3*(Upkey()-DownKey()):acc(0)=acc(0)+x2#-Object Position X(1):acc(1)=acc(1)+y2#-Object Position Y(1):acc(2)=acc(2)+z2#-Object Position Z(1)
Endif: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 Timer()-bt>100:Clear_Lights():Center(0)=Center(0)+.1:Center(1)=Center(1)-.2:Center(2)=Center(2)+.08:If MouseClick()=1:Make_Bullet(b):b=b+(b=2)-(b=3):bt=Timer():Endif:Endif:pitch object down 2,90:pitch object down 3,90
Move_Bullet():Meteor_Moves():Expand:Set Cursor 0,0:Print "Estimated deaths: ";people;"0 million!":Print "Time until impact: ";timeleft-((timer()-t)/1000):Print "Score: ";score:Print "Shields: ":Box 70,45,70+(shields/10),60,Rgb(255,0,0),Rgb(255,0,0),Rgb(255,0,0),Rgb(255,0,0):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;"000000"
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 "Score: ";score: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:#Constant Expand :For i = 501 to 510:If Object Exist(i):es(i-500)=es(i-500)*1.1:Scale Object i,es(i-500),es(i-500),es(i-500):If Object Collision(i,1)<>0:Play Sound 2:Delete Object i:Turn Object Right 1,(Rnd(10)-5)*3:Pitch Object Up 1,(Rnd(10)-5)*3:Else:If Object Size(i)>10000:Delete Object i:Endif:Endif:Endif:Next i
Function Meteor_Moves():alert=0: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):d#=((Object Position X(10+i)-Object Position X(1))*(Object Position X(10+i)-Object Position X(1))+(Object Position Y(10+i)-Object Position Y(1))*(Object Position Y(10+i)-Object Position Y(1))+(Object Position Z(10+i)-Object Position Z(1))*(Object Position Z(10+i)-Object Position Z(1))):If d#<Meteor(i,7)*Meteor(i,7)+100.0:Show Sprite 2:Alert=1:Endif: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)-100:Delete Object i+10:if s#>5:New_Meteor(s#,x#,y#,z#):New_Meteor(s#,x#,y#,z#):Endif:People=People-(s#*diff#/10):Endif:Endif:Next i:If Alert=0:Hide Sprite 2:Endif
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 Cull j+10,0:If size#<800:Set Object Collision To Boxes j+10:Else:Set Object Collision To Spheres j+10:Endif:Position Object j+10,x#,y#,z#:Meteor(j,0)=size#/10:For k=1 to 3:Meteor(j,k)=(rnd(1000.0)/100.0)-5.0:Meteor(j,k+3)=(rnd(400.0)/100.0)-2.0:Next k:Meteor(j,7)=size#
EndFunction:Function Make_Object_Rock(ObjectID,Size#,Roughness#):Make Object Sphere ObjectID,Size#,6.0+Size#/300.0,6.0+Size#/300.0:Scale Object Texture ObjectID,.5,.5:Texture Object ObjectID,1:Set Object Diffuse ObjectID,Rgb(255,0,0):Set Object Specular ObjectID,Rgb(255,0,0):Set Object Specular Power ObjectID,RGB(255,255,255):Set Object Emissive ObjectID,RGB(10,10,10):for A=0 to 75:LOCK VERTEXDATA FOR LIMB ObjectID, 0:for I=3 to Get VertexData Index Count()-4 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(40.0)-20.0)/(10.0/Roughness#/(Size#/20.0)):Y#=GET VERTEXDATA POSITION Y(V)+(Rnd(40.0)-20.0)/(10.0/Roughness#/(Size#/20.0)):Z#=GET VERTEXDATA POSITION Z(V)+(Rnd(40.0)-20.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 Off i:Color Object i,rgb(0,0,200):Set Object Emissive i,rgb(50,50,255):Position Object i,Object Position X(gun),Object Position Y(gun),Object Position Z(gun):Set Object To Object Orientation i,gun:Position Listener Object Position X(1),Object Position Y(1),Object Position Z(1):Rotate Listener Object Angle X(1),Object angle Y(1),Object Angle Z(1):Position Sound 1,Object Position X(i),Object Position Y(i),Object POsition Z(i):Play Sound 1
Endfunction:Function Move_Bullet():For i = 201 to 230:If Object exist(i):For j=1 to 2:If Object Exist(i):x1#=Object Position X(i):y1#=Object Position Y(i):z1#=Object Position Z(i):Move object i,10:For o=11 to 110:dc#=0:If Object Exist(o):dc#=Intersect Object(o,x1#,y1#,z1#,Object Position X(i),Object Position Y(i),Object Position Z(i)):If dc#>0:Exit:Endif:Endif:Next o:if o<111:oc=o:Else:oc=0:Endif:If oc>10:
Position Object i,x1#,y1#,z1#:Move Object i,dc#-.5:dec Meteor(oc-10,0),2:If Meteor(oc-10,0)<1:Fire_Light(i,10):Make_Explosion(oc):Hide Object oc:score=score+10:Set Object Collision Off oc:Endif:Fire_Light(i,2):If Meteor(oc-10,0)<5:Rotate Object i,rnd(359),Rnd(359),Rnd(359):Move Object i,rnd(20.0)/10.0:Fire_Light(i,4):Endif:Delete Object i:Endif:Endif:Next j:Endif:Next i:
Endfunction:Function Clear_Lights():For i = 1 to 16:If Light Exist(i):Delete Light i:Endif:If Particles Exist(i):Delete Particles i:Endif:Next i
EndFunction:Function Fire_Light(ObjectID,size#):x#=Object Position X(ObjectID):y#=Object Position Y(ObjectID):z#=Object Position Z(ObjectID):For i=1 to 16:If Light Exist(i)=0:Exit:Endif:Next i:If i>16:ExitFunction:Endif:Make Light i:Color Light i,Rgb(255,255,255):Position Light i,x#,y#,z#:Set Light Range i,Size#*100:Make Particles i,1,80,Size#*40:Position Particles i,x#,y#,z#:Color Particles i,255,100,100:
Endfunction:Function Make_Explosion(o):For i =501 to 510:If Object Exist(i)=0:Exit:Endif:Next i:If i>510:ExitFunction:Endif:es(i-500)=100:Make Object Sphere i,10,20,20:Set Sphere Mapping On i,1:Ghost Object On i:Set Object Ambience i,Rgb(255,0,0):Set Object Collision To Boxes i:Position Object i,Object Position X(o),Object Position Y(o),Object Position Z(o):Set Object To Object Orientation i,o
Endfunction:Function Bounce(m):If Object Position X(m+10)<-3000+Center(0) Or Object Position X(m+10)>3000+Center(0):Meteor(m,1)=Abs(Meteor(m,1))*((Object Position X(m+10)<Center(0))-(Object Position X(m+10)>Center(0))):Endif:If Object Position Y(m+10)<-3000+Center(1) Or Object Position Y(m+10)>3000+Center(1):Meteor(m,2)=Abs(Meteor(m,2))*((Object Position Y(m+10)<Center(1))-(Object Position Y(m+10)>Center(1))):Endif:If Object Position Z(m+10)<-3000+Center(2) Or Object Position Z(m+10)>3000+Center(2):Meteor(m,3)=Abs(Meteor(m,3))*((Object Position Z(m+10)<Center(2))-(Object Position Z(m+10)>Center(2))):Endif
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,-20000:Texture Object 4,4:Set Object Emissive 4,Rgb(255,0,0):set Object Light 4,0:Delete Bitmap 1
PS. Include the attached media.
Instructions:
-Use mouse to turn and pitch your ship.
-Upkey / Downkey to accelerate forward / backward.
-Leftkey / Rightkey to roll ship left / right.
-Left mouse button to fire.
-Proximity warning appears when a meteor is very close.
"Droids don't rip your arms off when they lose." -H. Solo
REALITY II