Home › Forums › TimelineFX Module › Simple Example of loading and using particle effect › Re: Re: Simple Example of loading and using particle effect
My field definitions look like:
' Particle Effects Fields
Field particles:tlParticleManager 'The main particle manager for GUI effects
Field effectslib:tlEffectsLibrary 'The effect library
Field CandleFlame:tlEffect
Field Tweener:tTweener
My loading method looks like:
' Setup Particles
SetUpdateFrequency(30)
Tweener = New tTweener.Create(30)
particles = CreateParticleManager()
particles.SetScreenSize(ScreenWidth, ScreenHeight)
particles.SetOrigin(ScreenWidth / 2, ScreenHeight / 2)
particles.SetIdleTimeLimit(5)
'load the effects library
effectslib = LoadEffects(Game.DataPrefix+"data/fx/Candle.eff")
CandleFlame = effectslib.GetEffect("Candle Flame")
Local e:tlEffect = CopyEffect(CandleFlame, particles)
e.sety(449)
e.setx(32)
particles.addeffect(e)
My Draw loop looks like:
' Draw Candles and effects
If Game.Fading()=0 Or Game.Paused=0 Then
Tweener.Update()
For Local Ticks:Int = 1 To Tweener.FrameTicks
Tweener.UpdateExecutionTime()
particles.Update()
Next
particles.DrawParticles(Tweener.Tween)
EndIf