Page 1 of 1

sprite image trails

Posted: Sun Feb 16, 2014 10:56 pm
by Unin
Does anyone know of a good way of getting sprites to leave a temporary "image trail"?

I'm trying to emulate tracer fire for a shooting gallery mini-game that arcs from one or more positions off-screen towards the mouse before disappearing (kind of a reverse of the "repulsor" sprite demo), following a spline (to make the sprites arc rather than straight line), and in doing so I realized that my long sprites couldn't rotate (much less curve) with the arc. I thought a simple solution to this would be to create some sort of image trail; multiple identical circular segments partially overlapping and following the lead segment. That way they could follow the sort of parabolic arcs I wanted and look like a tracer round. I understand I could do this with composite probably, but I want to be able to have multiple (at least dozens) of individual "bullets" on screen each followed by its own "trail".

Is this possible within the limits of sprites? Is there a better way of doing it? Is this use of sprites likely to slow Ren'Py to a crawl?

Re: sprite image trails

Posted: Mon Feb 17, 2014 7:04 am
by Steamgirl
I would guess you probably want to use particles for this? I'm no good at particles though... they always take a while to figure out for custom effects.

http://www.renpy.org/wiki/renpy/doc/ref ... /Particles

Particle burst example:
http://www.renpy.org/wiki/renpy/doc/coo ... icle_Burst

Re: sprite image trails

Posted: Mon Feb 17, 2014 10:56 am
by Unin
I was under the impression particles and sprites where the same thing. what is the distinction?

Re: sprite image trails

Posted: Mon Feb 17, 2014 1:14 pm
by Steamgirl
Well a particle system is set up for creating effects with (often) a single sprite. Depending on how it's done in the engine, it'll be optimised for multiple instances of the same sprite, resulting in better performance. I'm generalising here though - don't know what ren'py does under the hood and I'm sure there are some cases where an animation is better than a particle system, etc.

With a particle system things like leaving a trail are sort of built in - you could set up an emitter that follows a particular path and emits a single particle every X steps/seconds, give the particle a lifespan of X seconds and a fade out effect. Voila, it's a trail.

It may or may not be appropriate in this case? It's kinda hard to visualise what you're trying to achieve based purely on a description. XD

Re: sprite image trails

Posted: Mon Feb 17, 2014 8:18 pm
by Unin
I understand that particle systems are an efficient way of showing many of a single displayable on the screen at once... but a lot of the documentation for "particle systems" and "sprite systems" seem to be copy and pasted from the same article. For example, depending on which one you read, "SnowBlossom" is either a particle system or a sprite system. It also doesn't help that most posts dealing with "sprites" are using the general "art asset" sense of the term rather than the actual sprite class. very confusing. I think particle factory might be easier to implement than dealing with sprite manager, but it seems like the two classes have a lot of overlap, and I'm not sure if one is legacy code and the other a future replacement. Thank you for your help and perspective.