Sprite trails

  • Looking for a better method to do sprite trails, other than putting a fade behavior on a sprite.

    Something like an fx you put on a layer and it draws a fading target texture underneath any object that's on its layer.

    Tagged:

  • The Drawing Canvas can do this

    Have the sprite spawn multiple drawing canvases that paste the sprite and then fade out

  • Not sure I follow. Thats sounds about the same as spawning instances that fade.

    The idea is to get away from so many objects, and reduce cpu bottlenecks.

  • I think the suggestion was to not use objects, just the paste the current object position onto the canvas.

    A trick I've used with canvas 2D in the past is to not clear at the start of each frame, but paint a low opacity rect over the whole canvas to "fade" the entire contents. I haven't looked into such thing with the drawing canvas, but it might be workable?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Following this - I've often used the method described by Newt, however if performance drops or even hiccups the illusion is ruined.

    Interested if there's a better way.

  • This is the trick I described before, can lead to some minor colour artifacts unfortunately. That's down to fact that the maths means the fade tends towards 0 but never reaches it. Might still be useful though

  • I think ideally it would be an fx that doesn't require any events.

    Plus I think you would want to have some parameter for the fade.

    Pasting into DC is better, but just using a Particle is better.

    It has its own artifacts however.

    dropbox.com/s/tc2o9a71d6ubule/particletrail.c3p

  • This is a way that someone shared me about how to make the trail

  • newt

    The particle method looks good, I expect the artifacts are down to matching the emission rate to the movement update rate. If a particle isn't emitted on a frame when the object moves then it appears to sit still for the frame ( or sometimes move backwards ). These sort of time sync issues are a problem in most solutions unfortunately, due to fact we have to use discreet time steps. The drawing canvas one has obvious gaps when it moves more on a frame ( either due to a change in speed or a long tick ) you can technically fill these gaps by interpolating the position change and painting multiple times per tick.

    I'm not sure how feasible an effect would be, you need to keep track of the data somewhere. Either as a texture of the previous frame or the location of points. The texture variant would basically be what drawing canvas is doing ( although the fade could be calculated on a per pixel basis, preventing the ghosting issue ). The latter requires more information than effects have I believe.

    Maverick1912

    That looks like a pretty solid trail system, but I believe the OP is searching for a technique which doesn't involve creating many instances per trail.

  • Maybe a combination of DC, and Fx. Where you paste a texture, and the layer fx fades any new texture?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)