+ Code SnippetSync On:Sync Rate 60:Autocam Off
Set Camera Range .01,3000
`Color Backdrop 0
null=Make Vector3(1)
Type vectors
x as float
y as float
z as float
Endtype
Type attributes
p as vectors
a as vectors
v as vectors
s as vectors
Endtype
Global temp as attributes
Global speed as float
Dim Roid(500) as attributes
speed#=.01
Splotch(150,20)
Ink Rgb(0,0,200),0
Box 0,0,270,270
Sprite 1,0,0,1
Lock Pixels
For i = 1 to 200
Rotate Sprite 1,rnd(360)
Set Sprite Diffuse 1,0,rnd(100)+50,0
Paste Sprite 1,rnd(180)+13,rnd(150)+43
Next i
Unlock Pixels
Blur Bitmap 0,3
Get Image 2,4,4,260,260,1
Ink Rgb(255,255,255),0
Make Object Sphere 1,380,180,180
Texture Object 1,2
Set Object Diffuse 1,Rgb(255,255,255)
Set Object Specular 1,Rgb(255,255,50)
Set Object Specular Power 1,200
Splotch(150,20)
Ink Rgb(0,0,0),0
Box 0,0,270,270
Sprite 1,0,0,1
Lock Pixels
c=rnd(50)+200
Set Sprite Diffuse 1,c,c,c
For i = 1 to 100
Rotate Sprite 1,rnd(360)
Paste Sprite 1,rnd(180)+13,rnd(150)+43
Next i
Unlock Pixels
Blur BItmap 0,3
Get Image 3,0,0,256,256,0
Ink Rgb(255,255,255),0
Make Object Sphere 2,382,120,120
Texture Object 2,3
Ghost Object On 2
Set Object Light 2,0
Fade Object 2,90
Splotch(150,20)
Ink Rgb(35,25,15),0
Box 0,0,270,270
Sprite 1,0,0,1
Lock Pixels
For i = 1 to 200
Rotate Sprite 1,rnd(360)
c=rnd(50)+25
Set Sprite Diffuse 1,c+10,c,c-10
Paste Sprite 1,rnd(256),rnd(150)+43
Next i
Unlock Pixels
Get Image 100,4,4,260,260,0
Ink Rgb(255,255,255),0
Make Object Sphere 100,4,5,5
Make Mesh From Object 1,100
Delete Object 100
Make Object triangle 100,0,0,0,0,.01,0,0,0,0
Add Limb 100,1,1
Offset Limb 100,1,0,200,0
Rotate Object 100,Rnd(360),Rnd(360),Rnd(360)
Roid(0).s.x=(rnd(20.0)/10.0)-1.0
Roid(0).s.y=(rnd(20.0)/10.0)-1.0
Texture Limb 100,1,100
Set Object Diffuse 100,Rgb(200,200,200)
Set Object Ambience 100,Rgb(200,200,180)
Set Object Emissive 100,rgb(25,25,23)
Set Object Specular 100,rgb(50,50,10)
Set Object Specular Power 100,30
For i = 1 to Array Count(Roid(0))
Clone Object 100+i,100
Rotate Object 100+i,Rnd(360),Rnd(360),Rnd(360)
Roid(i).s.x=(rnd(20.0)/10.0)-1.0
Roid(i).s.y=(rnd(20.0)/10.0)-1.0
Next i
Make Object triangle 3,0,0,0,0,.01,0,0,0,0
Make Mesh From Object 1,3
Add Limb 3,1,1
Offset Limb 3,1,0,200,0
Hide Object 3
`Lock Pixels
Create Bitmap 1,512,512
Ink 0,0
Box 0,0,512,512
For i = 0 to 2000+rnd(1000)+Rnd(1000)
ink rgb(rnd(55)+200,rnd(55)+200,rnd(55)+200),0
Dot rnd(512),Rnd(512)
Next i
`Unlock Pixels
Ink rgb(255,255,255),0
Get Image 1,0,0,512,512,0
Delete Bitmap 1
Set Current Bitmap 0
Make Object Cube 5,2000
Texture Object 5,1
Set Object Light 5,0
Set Object Emissive 5,rgb(100,100,100)
Set Object Cull 5,0
Ink Rgb(255,255,0),0
Box 0,0,128,128
Get Image 6,0,0,128,128,0
Ink rgb(255,255,255),0
For i = 6 to 9
Make Object Sphere i,-540+i*100,12,12
Texture Object i,6
Position Object i,500,60,400
Set Object Emissive i,Rgb(255,255,255)
Ghost Object On i
Fade Object i,60-i*2
Next i
Ghost Object Off 6
Set Object Light 6,0
Fade Object 6,255
Hide Light 0
Make Light 1
Color Light 1,255,255,50
Position Light 1,500,60,400
Set Light Range 1,2000
Set Ambient Light 25
click=0
Do
Turn Object Left 1,.002
Turn Object Left 2,.005
Turn Object Right 5,.002
Pitch Object Down 3,(Upkey())*.05
Turn Object Left 3,(LeftKey()-RightKey())*1.0
Position Camera LPosX (3,1), LPosY (3,1), LPosZ (3,1)
Rotate Camera LDirX (3,1), LDirY (3,1), LDirZ (3,1)
Move_Asteroids()
If MouseClick()=1 and click=0
click = 1
Make_Bullet()
Endif
click=MouseClick()
Move_Bullets()
Set Cursor 0,0
Print "FPS: ";Screen FPS()
Sync
Loop
Function Move_Asteroids()
For i = 0 to Array Count(Roid(0))
If Object Visible(100+i)
Pitch Object Down 100+i,speed
Rotate Limb 100+i,1,LAngx (100+i,1)+Roid(i).s.x , LAngY (100+i,1)+Roid(i).s.y , LAngZ (100+i,1)+Roid(i).s.z
Else
Pitch Object Down 100+i,speed
r#=Get_Limb_Distance(100+i,1,3,1)
If r#>150
Show Object 100+i
speed=speed+.0002
Endif
Endif
Next i
Endfunction
Function Record_Rotation(ObjectID)
temp.a.x = AngX (ObjectID)
temp.a.y = AngY (ObjectID)
temp.a.z = AngZ (ObjectID)
Endfunction
Function Record_Position(ObjectID)
temp.p.x = PosX (ObjectID)
temp.p.y = PosY (ObjectID)
temp.p.z = PosZ (ObjectID)
Endfunction
Function Record_Camera_Rotation()
temp.a.x = CAngX ()
temp.a.y = CAngY ()
temp.a.z = CAngZ ()
Endfunction
Function Record_Camera_Position()
temp.p.x = CPosX ()
temp.p.y = CPosY ()
temp.p.z = CPosZ ()
Endfunction
Function Get_Planet_Distance(ObjectID)
Set Vector3 1,PosX (ObjectID)- PosX (1),PosY (ObjectID)-PosY (1),PosZ (ObjectID)-PosZ (1)
d#=Length Vector3(1)
Endfunction d#
Function Get_Object_Distance(Obj1,Obj2)
Set Vector3 1,PosX (Obj1)-PosX (Obj2),PosY (Obj1)-PosY (Obj2),PosZ (Obj1)-PosZ (Obj2)
d#=Length Vector3(1)
Endfunction d#
Function Get_Limb_Distance(Obj1,L1,Obj2,L2)
Set Vector3 1,LPosX (Obj1,L1)-LPosX (Obj2,L2),LPosY (Obj1,L1)-LPosY (Obj2,L2),LPosZ (Obj1,L1)-LPosZ (Obj2,L2)
d#=Length Vector3(1)
Endfunction d#
Function Move_Bullets()
For i = 1000 to 1200
If Object Exist(i)
If Object Visible(i)
Pitch Object Down i,.3
For j=0 to Array Count(Roid(0))
If Object Visible(100+j)=1
r#=Get_Limb_Distance(i,1,100+j,1)
if r#<2
Hide Object 100+j
Hide Object i
Exit
Endif
Endif
Next j
Endif
Endif
Next i
Endfunction
Function Make_Bullet()
b=Free_Bullet()
if b=0 then exitfunction
If Object Exist(b)=0
Make Object triangle b,-.05,0,0,0,0,3,.05,0,0
Make Mesh From Object 1,b
Add Limb b,1,1
Offset Limb b,1,0,199.3,0
Color Limb b,1,rgb(255,0,0)
Set Object Emissive b,rgb(200,100,100)
Set Object Cull b,0
Else
Show Object b
Endif
Rotate Object b,AngX (3),AngY (3), AngZ (3)
Pitch Object Down b,.5
Endfunction
Function Free_Bullet()
flag=0
For i = 1000 to 1200
If Object Exist(i)=0
flag=1
Exit
Endif
If Object Visible(i)=0
flag=1
Exit
Endif
Next i
i=i*flag
Endfunction i
Function Splotch(h,s)
Lock Pixels
Ink 0,0
Box 200,200,230+s,230+s
c=rnd(7)+h-3
Ink Rgb(c,c,c),0
r=rnd(s/2)+s/4
For i# = 0.0 to 360.0 step 2
x=sin(i#)*r+215+s/2
y=cos(i#)*r+215+s/2
line 207+s/2,207+s/2,x,y
r=r+(rnd(2)-1)
if r>s+15 then r=s+15
m=s-15:If m<2 then m=2
if rthen r=m
Next i#
Unlock Pixels
Get Image 1,200,200,230+s,230+s
Endfunction
#Constant PosX Object Position X
#Constant PosY Object Position Y
#Constant PosZ Object Position Z
#Constant AngX Object Angle X
#Constant AngY Object Angle Y
#Constant AngZ Object Angle Z
#Constant CPosX Camera Position X
#Constant CPosY Camera Position Y
#Constant CPosZ Camera Position Z
#Constant CAngX Camera Angle X
#Constant CAngY Camera Angle Y
#Constant CAngZ Camera Angle Z
#Constant LPosX Limb Position X
#Constant LPosY Limb Position Y
#Constant LPosZ Limb Position Z
#Constant LDirX Limb Direction X
#Constant LDirY Limb Direction Y
#Constant LDirZ Limb Direction Z
#Constant LAngX Limb Angle X
#Constant LAngY Limb Angle Y
#Constant LAngZ Limb Angle Z