Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 26th, 2012  |  syntax: Lua  |  size: 1.07 KB  |  hits: 29  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. system = ParticleSystem()
  2.  
  3. function createEmitter()
  4.         emitter = ParticleEmitter()
  5.         emitter.size = 0.5
  6.         emitter.maxParticles = 1400
  7.         emitter.numToEmit = 5
  8.         emitter.emitIntervall = 0.05
  9.         emitter.lifeCycle = 2
  10.         emitter.velocityAmount = 1
  11.         emitter.airResistance = false
  12.         emitter.velocity = Vector3(0, 15, 0)
  13.         emitter.gravity = Vector3(0, -15, 0)
  14.         emitter.position = Vector3(0, 0, 10)
  15.         emitter:initialize()
  16.        
  17.         emitter2 = ParticleEmitter()
  18.         emitter2.maxParticles = 1400
  19.         emitter2.numToEmit = 5
  20.         emitter2.emitIntervall = 0.02
  21.         emitter2.lifeCycle = 2
  22.         emitter2.velocityAmount = 1
  23.         emitter2.airResistance = false
  24.         emitter2.velocity = Vector3(0, 15, 0)
  25.         emitter2.gravity = Vector3(0, -15, 0)
  26.         emitter2.position = Vector3(0, 0, 10)
  27.         emitter2.color = Color(0, 0.5, 1, 1)
  28.         emitter2:initialize()
  29.        
  30.         system:addEmitter(emitter)
  31.         system:addEmitter(emitter2)
  32. end
  33.  
  34.  
  35.  
  36. function onDraw(elapsedTime)
  37.         system:update(elapsedTime)
  38. end
  39.  
  40.  
  41. function main()
  42.         game:showConsole()
  43.         game:initialize(800, 600, "Test")
  44.  
  45.         createEmitter()
  46.  
  47.         game:setOnDrawEvent(onDraw)
  48.         game:start()
  49. end