; ParticleTotalEmitted 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 ; A campfire that has been burning since the program started emitter=CreateParticleEmitter(800) PositionEntity emitter,0,0.25,0 ParticlePreset emitter,1 While Not KeyDown(1) ; Space adds a burst, C clears live particles (the total keeps counting) If KeyHit(57) Then EmitParticles emitter,200 If KeyHit(46) Then ClearParticles emitter ; 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 Space: burst C: clear live Esc: exit" ; The lifetime total only ever climbs, unlike the live count Text 0,20,"ParticleTotalEmitted(emitter) = "+ParticleTotalEmitted(emitter) Text 0,40,"CountParticles(emitter) = "+CountParticles(emitter) Flip Wend End