Hi, I’m making a small game with some effects using CBE plugin. The hero will catch some energy items on the go. I would like to make the energy item fly to the container with a trail. I use simple particle effect and move it (x, y) per frame. The result is quite good but the trail is not smooth. See my result
How can I make the trail smooth? Anyone have any ideas to achieve smooth trail.
My code:
function Energy:enterFrame(event) -- omit object moving calculation self.vent:set({emitX = self.view.x, emitY = self.view.y}) end
Thanks in advance!
Does the trail break regularly? Like smooth-smooth-smooth-break-smooth-smooth-smooth-break, in regular intervals? If it does, you can turn your perEmit to 1 and your emissionNum to 0, and the particles will continually be spawned one at a time.
If it only breaks when your objects move fast, I’d suggest either slowing them down or using a points-on-line calculation and emitting at each location.
Thank you Caleb. I tried your points-on-line calculation suggestion and got it really smooth ;). But it breaks my game performance, the FPS drops a lots =)) (45fps/500 particles/4 trails). I’m trying to optimize it.
Don’t forget the simple optimization method of not using every point. Just do every other point - even that little step should make it twice as fast.
You’re right Caleb. I have optimized it by using a “spawn interval” distance. This allow me to adjust the density of particles. The result is smooth and save the game’s fps.
Thanks again for your advice.
Does the trail break regularly? Like smooth-smooth-smooth-break-smooth-smooth-smooth-break, in regular intervals? If it does, you can turn your perEmit to 1 and your emissionNum to 0, and the particles will continually be spawned one at a time.
If it only breaks when your objects move fast, I’d suggest either slowing them down or using a points-on-line calculation and emitting at each location.
Thank you Caleb. I tried your points-on-line calculation suggestion and got it really smooth ;). But it breaks my game performance, the FPS drops a lots =)) (45fps/500 particles/4 trails). I’m trying to optimize it.
Don’t forget the simple optimization method of not using every point. Just do every other point - even that little step should make it twice as fast.
You’re right Caleb. I have optimized it by using a “spawn interval” distance. This allow me to adjust the density of particles. The result is smooth and save the game’s fps.
Thanks again for your advice.