Function Shoot_Bullet()
If Reload>0
Dec Reload
ExitFunction
Endif
If Mouseclick()<>1 Then Exitfunction
Reload=ReloadTime
B=Make_Bullet()
If B<1 then Exitfunction
Position Object B,CamX,CamY,CamZ
Set Object To Camera Orientation B
Move Object Right B,.2
bx#=Object Position X(B):by#=Object Position Y(B):bz#=Object Position Z(B)
Pick Screen MouseX(),MouseY(),1000
Point Object B, CamX +Get Pick Vector X(), CamY +Get Pick Vector Y(), CamZ +Get Pick Vector Z()
Move Object B,5
Set Vector3 B,Object Position X(B)-bx#,Object Position Y(B)-CamY,Object Position Z(B)-bz#
Endfunction
Function Get_Free_Bullet()
flag=0
For i = 2001 to 3000
If Object Exist(i)=0
flag=1
Exit
Endif
Next i
If flag
null=Make Vector3(i)
Else
i=-1
Endif
Endfunction i
Function Make_Bullet()
blt=Get_Free_Bullet()
If blt=-1 Then ExitFunction -1
Make Object Sphere blt,1,6,6
Scale Object blt,25,25,500
Set Object Collision To Boxes blt
Endfunction blt
Function Move_Bullets()
For i = 2001 to 3000
If Object Exist(i)
Set Vector3 1,Object Position X(i)-CamX,Object Position Y(i)-CamY,Object Position Z(i)-CamZ
If Length Vector3(1)>500 or Object Position Y(i)<0
Delete Object i
Else
Position Object i,Object Position X(i)+X Vector3(i),Object Position Y(i)+Y Vector3(i),Object Position Z(i)+Z Vector3(i)
Set Vector3 i,X Vector3(i),Y Vector3(i)-.01,Z Vector3(i)
Endif
Endif
Next i
Endfunction
Open MMORPG: It's your game!