make a smoke trail effect for infinite spawning objects?

i’m very much a noob scripter, but i can get it figured out if someone can just point me in the right direction.

i want to add a smoke trail or fire trail effect to objects. i’m spawning the objects at random time intervals and attempting to make a vent follow the objects atpoint x and y with runtime enterframe. 

my problem is that with every new object spawned the vent leaves the first object and follows the second, then when third object is spawned the vent leaves the second object and follows the third,etc,etc. i want all objects to have a smoke trail, so how would i go about making a vent for each object?

i think i need to insert the objects into an index table and then apply the vents to the index’s. but how do i create individual vents for the objects without manually creating a million vents?

sry if what i’m trying to say sounds confusing

You could make a new vent per object, and destroy it when the object is destroyed. This creation would take place when you spawn the object, inside the spawning function:

object.vent = CBE.newVent({ ... })

Then, when you destroy the object, also destroy the object’s vent:

object.vent.destroy() display.remove(object) -- Or object:removeSelf() object = nil
  • Caleb

ty so much. this works perfectly     :smiley:

btw, i’ve already released one app that uses your particle effects and I was happy to add your info and logo on the credits screen.

You could make a new vent per object, and destroy it when the object is destroyed. This creation would take place when you spawn the object, inside the spawning function:

object.vent = CBE.newVent({ ... })

Then, when you destroy the object, also destroy the object’s vent:

object.vent.destroy() display.remove(object) -- Or object:removeSelf() object = nil
  • Caleb

ty so much. this works perfectly     :smiley:

btw, i’ve already released one app that uses your particle effects and I was happy to add your info and logo on the credits screen.