Small Lightning Bolt Test

Miscellaneous Forums/Blitz Showcase/Small Lightning Bolt Test

My little lightning bolts!

Edit: Picture:


http://s87776868.onlinehome.us/stuff/lightning.zip

The little 'rods' are just Blitz primitives.

Source:
;use the arrow keys to move

Graphics3D 800,600,32,Int(Input$("Windowed: (0 or 1)   "))+1

Include "h_lotus.bb"

InitLotus()

;; CAMERA
C = CreateCamera()
PositionEntity C,-10,10,-10
CameraClsColor C,32,32,32
CameraClsMode C,1,1
CameraRange C,.01,10000
SetLotusCamera C

;; FPS
MFPS = 45
Period = 1000/MFPS
Time = MilliSecs()-Period

Global fps,timenext,frames

;; LIGHT
L = CreateLight(2)
PositionEntity L,24,24,24
LightRange L,Sqr(64*64*3)/4
LightColor L,255,255,255
AmbientLight 128,128,128


;;EMITTERS
Global gLightning

gLightning = LoadEmitter("media/ln.png")
SetEmitterParticleMesh gLightning,cP_TRAIL
SetEmitterSizeFrom gLightning,2,2
SetEmitterColorTo 0,255,255,255,1
SetEmitterBlend 0,3
SetEmitterSizeTo 0,2,2
SetEmitterRandomRotation 0,0,10,0,0,-10
SetEmitterAngle 0,0,0,90

Function Strike(X#,Y#,Z#,TX#,TY#,TZ#,AX#,AY#,AZ#,Amount,Chaos#)
	SetEmitterLifeSpan 0,Rand(3,14)
	DX# = TX-X
	DY# = TY-Y
	DZ# = TZ-Z
	Chaos# = Abs(Chaos)
	For N# = 0 To Amount
		From# =N/Float(Amount)
		If N = Amount Or N = 0 Then
			SetEmitterColorFrom 0,0,0,0,0
			SetEmitterColorTo 0,0,0,0,0
			If N = 0 Then
				SetEmitterPosition gLightning,X,Y,Z
			Else
				SetEmitterPosition gLightning,TX,TY,TZ
			EndIf
		Else
			SetEmitterPosition gLightning,X+DX*From+Sin(From*180)*AX+Rnd(-Chaos/2,Chaos/2),Y+DY*From+Sin(From*180)*AY+Rnd(-Chaos/2,Chaos/2),Z*DZ*From+Sin(From*180)*AZ+Rnd(-Chaos/2,Chaos/2)
			SetEmitterColorFrom 0,220,255,255,1
			SetEmitterColorTo 0,220,255,255,1
		EndIf
		CreateParticle gLightning
	Next
End Function

Te = 250

S = CreateSphere()
PositionEntity S,-10,20,0
S = CopyEntity(S)
PositionEntity S,10,20,0
L = CreateCylinder()
PositionEntity L,-10,10,0
ScaleEntity L,.2,10,.2
L = CopyEntity(L)
PositionEntity L,10,10,0

Repeat
     Repeat
          Elapsed = MilliSecs() - time
     Until Elapsed

     Ticks=Elapsed/Period
     Tween#=Float(Elapsed Mod Period) / Float(Period)

     For U = 0 To Ticks
          Time = Time + Period

		Y# = Y + .2
		If Y > 20 Then
			Y = 0
		EndIf
		
		;For N = 0 To Rand(0,5)
			Strike -10,Y,0,10,Y,0,Rnd(-2,2)*Y/20,Y/3,Rnd(-2,2)*Y/20,Rand(3,10),1.8
		;Next

          ;; UPDATE CAMERA
          mxs# = mxs + Float(MouseXSpeed())/3
          mys# = mys + Float(MouseYSpeed())/3
          mxs = mxs - mxs/4
          mys = mys - mys/4
          TurnEntity C,mys,-mxs,0
          RotateEntity C,Min(Max(EntityPitch(C),80),-80),EntityYaw(C),0
          MoveEntity C,(KeyDown(205)-KeyDown(203))*2,0,(KeyDown(200)-KeyDown(208))*2
          MoveMouse GraphicsWidth()/2,GraphicsHeight()/2
          
;;          ;; UPDATE PARTICLES

          
          T = MilliSecs()
          UpdateLotusParticles()
          T = MilliSecs() - T

          UpdateWorld

          If U = Ticks Then CaptureWorld
     Next

     RenderWorld Tween

;	AppTitle GetFPS(False)
     Text 2,2,"FPS: "+GetFPS(False)
     Text 2,22,T
     Text 2,42,"Particles: "+gLotusParticleCount

     Flip False
Until KeyHit(1)

KillLotus()

Function GetFPS(JustChecking = False)
     If Not JustChecking Then frames = frames+1

     If MilliSecs() > timenext Then
          timenext = MilliSecs()+1000
          fps = frames
          frames = 0
     EndIf
     Return fps
End Function


Looks wicked

Is the source and media public domain ?

I tried running the source, but I get function not found on SetLotusCamera C.

Looks pretty nice Noel! nice work ;)

dill, you'll probably need the lotus particle system as well
( Include "h_lotus.bb" )

Oh, I had lotus, but I just needed the newer version from noel's site, which I jsut got. Looks great!

CyberHeater: The source and media in the archive (lightning.zip) is public domain, yes. The Lotus Particle System comes with its own license detailing (albeit briefly) the conditions of use.

Thanks Noel.

FUN


Impressive stuff there :)

You should get this guy to test it for you:
http://www.dc101.com/videos/shmoo6.mpg

I have a feeling I'm going to laugh my arse off when I see that video. -_-

Edit: HA HA HA HA HA HA HA HA HA HA... a gathering of dorks!

It's either star trek, dorks in costumes or IRC.

I pick IRC.

I've had enough fun with the lightning/electricity for now


Now this probably has no signifigance, but I figure it's a good thing to post



New one up

And no, it's not a trout slap.

So Noel... I just got to thinking cause someone else posted about dizzyness... whatever happened with your blood test?

It came back normal.

Looks nice .I got 348 fps on mine
Think it was 90 particles or something

Glad to hear it. At least now you know you're healthy. That's something to be happy about. You could have found out you were diabetic and then had to take insulin shots or something twice a day every day for the rest of your life. Or worse.

Oh yes, I uploaded the screensaver version 'cause it just looks awesome.

The screensaver version has four colors and uses Lotus R2 and Bouncer's (awesometastic) bloom filter effect. If you download it, remember to read the readme.


sswift: Yeah, it's a huge relief. The doctor thinks it's a chemical imbalance- something to do with seratonine (or however that's spelled)-, so I started on Effexor XR about a week ago. There've been no side-effects, so we're going to see how it works out.