Display effects in one particular Display Group

Hi Caleb,

it was giving me  a nil when  I move to another scene … i dont know why it is working fine for me :)… i tried to simulate the issue but it is working :slight_smile:

thanks for your support and quick response.

regards

Abdul

Good Day,

Thanks for your reply I got it worked.

I have another issue with the library and I hope you can help with this.

I use the CBEffects on a storyboard, but I got error everytime I change the scene

error.jpg

What is the right way to start/end the effect?

I start the “burn” effect when the game is over, then end it before I go to the next scene, but I got the above error, I have no idea why I follow your example. Is this incompatible with the storyboard scenes?

Please help,

Thanks

To end the effect instantly (e.g. leaving a scene), you’ll want vent:destroy(). That clears the particles, cancels all the timers, etc.

If you just call vent:stop(), that just stops further particles from being emitted. The particles already on the screen still exist, which is usually why you get that error.

  • Caleb

Good Day,

Thanks it worked

Hi team ,

i am having the same issue in composer. When I use    vent:destroy() , I got nil value even it is running in the simulator… Any hint ??

Thanks

Abdul

Just to recap, vent:destroy() is equivalent to displayObject:removeSelf() or display.remove(displayObject). You should call it just before leaving a scene.

If you’re already doing that, I’ll need an example of your code. vent:destroy() is working for me.

  • Caleb

Hi Caleb,

What i noticed is the following ,

if i define vent above all functions as global variable and initialise it there then vent:destroy() and other works…

on the other hand , if you create function called for example animate() and include the initialisation of vent inside this function then destroy does not work…

[lua]

local vent – general variable 

– some code

animate() –  start works

– some code

function animate ()

 vent = CBE.newVent {}

 vent:start()  

end

function scene:destroy( event )

   vent:destroy() – does not work

end

[/lua]

thanks 

Abdul

What’s your error?

Make sure that no vent methods are getting called after vent:destroy().

  • Caleb

Hi Caleb,

it was giving me  a nil when  I move to another scene … i dont know why it is working fine for me :)… i tried to simulate the issue but it is working :slight_smile:

thanks for your support and quick response.

regards

Abdul