; ParticleEmitterShape Example ; ---------------------------- ; Requires Extended mode. Graphics3D 640,480,0,2 SetBuffer BackBuffer() camera=CreateCamera() PositionEntity camera,0,2,-6 CameraClsColor camera,8,12,24 floor=CreatePlane() EntityColor floor,30,34,44 ; Shape names for the overlay Dim shape_name$(3) shape_name$(0)="0 point" shape_name$(1)="1 box 3x0.5x3" shape_name$(2)="2 sphere radius 1.5" shape_name$(3)="3 cone 1.5x1.5x1.5" ; Slow glowing motes so the emission volume is easy to see emitter=CreateParticleEmitter(1000) PositionEntity emitter,0,1.5,0 ParticleEmissionRate emitter,250 ParticleLifetime emitter,1,1.5 ParticleVelocity emitter,0,0.3,0,0.1,0.1,0.1 ParticleColor emitter,150,220,255,1,80,120,255,0 ParticleSize emitter,0.06,0.03,0.2 EntityBlend emitter,3 shape=2 ParticleEmitterShape emitter,2,1.5,1.5,1.5 While Not KeyDown(1) ; Keys 1-4 select point, box, sphere or cone emission If KeyHit(2) shape=0 ParticleEmitterShape emitter,0 EndIf If KeyHit(3) shape=1 ParticleEmitterShape emitter,1,3,0.5,3 EndIf If KeyHit(4) shape=2 ParticleEmitterShape emitter,2,1.5,1.5,1.5 EndIf If KeyHit(5) shape=3 ParticleEmitterShape emitter,3,1.5,1.5,1.5 EndIf ; Arrow keys move the camera If KeyDown(200) Then MoveEntity camera,0,0,0.1 If KeyDown(208) Then MoveEntity camera,0,0,-0.1 If KeyDown(203) Then TurnEntity camera,0,1,0 If KeyDown(205) Then TurnEntity camera,0,-1,0 ; UpdateWorld also advances the particle simulation UpdateWorld RenderWorld Text 0,0,"Arrow keys: move camera 1/2/3/4: emitter shape Esc: exit" Text 0,20,"ParticleEmitterShape: "+shape_name$(shape) Flip Wend End