beam rifle

Blitz3D Forums/Blitz3D Beginners Area/beam rifle

Like This?

Hold space to make a beam

Graphics3D 800,600,0,2
SeedRnd MilliSecs()
SetBuffer BackBuffer()
Global light = CreateLight(2)
Global camerapivot= CreatePivot()
Global camera = CreateCamera(camerapivot) 

Setup3d()

Type Link
	Field E
End Type 


While Not KeyDown(1)
Cls


If KeyDown(203) Then TurnEntity Camerapivot,0,1,0
If KeyDown(205) Then TurnEntity Camerapivot,0,-1,0
If KeyDown(200) Then MoveEntity CameraPivot,0,0,1
If KeyDown(208) Then MoveEntity Camerapivot,0,0,-1


If KeyDown(57)
NewLink()
EndIf 
UpdateLinks()


UpdateWorld()
RenderWorld()
Flip 
Delay 1
Wend


End  


Function NewLink()
	L.Link=New Link
	L\E=CreateCylinder(6)
        EntityColor L\e,255,0,0
	RotateMesh L\e,90,0,0
	ScaleEntity L\e,.1,.1,2
Return
End Function 
Function UpdateLinks()
	For L.Link=Each LInk
		MoveEntity L\e,0,0,1
	Next
Return
End Function 


Function Setup3d()
SetBuffer BackBuffer()
SeedRnd MilliSecs() 
If Light <> 0 
RotateEntity light, 90,0,0
LightColor Light,255,255,255
PositionEntity Light,0,100,0
LightRange Light,100000
EndIf 
EntityRadius camerapivot,1
CameraRange camera,1,100
CameraFogMode camera,1
CameraFogRange camera,60,100
PositionEntity camerapivot,0,2,0
PositionEntity camera,0,30,30
PointEntity Camera,Camerapivot
Return 
End Function