Page 1 of 1

How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 5:53 pm
by Vimm
I want to make a little trailing effects behind a moving rectangle I have, but I don't know how to do it. I know that I should use LOVEs particle system, but I can't get those to work, partly because the wiki doesn't tell me what parameters the particle functions take, like if I use

Code: Select all

love.graphics.newParticleSystem()
I get an error saying it expects a texture of some sort.
Can anyone help me understand how to use the particle system to make the trail?

Re: How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 6:18 pm
by Manyrio
Yes it's normal, if you want to create particle with Löve you have to define some thing
on the wiki, there is a little tutorial :
https://love2d.org/wiki/love.graphics.newParticleSystem

Re: How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 6:48 pm
by Vimm
Manyrio wrote:Yes it's normal, if you want to create particle with Löve you have to define some thing
on the wiki, there is a little tutorial :
https://love2d.org/wiki/love.graphics.newParticleSystem
what if im using love.graphics.rectangle() and not an img?

Re: How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 6:51 pm
by Manyrio
use canvas, do a canvas on your rectangle then use it for your particles

Re: How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 9:05 pm
by Vimm
Manyrio wrote:use canvas, do a canvas on your rectangle then use it for your particles
ok its kinda working, but..
1) the particles start off screen and im not sure why
2) they kinda spray off in random directions, I want it to trail behind my square no whatever the direction i move it in.

I attached the LOVE

Re: How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 9:55 pm
by Sulunia
I never really messed with the particle systems. Usually i just create a table with past values and draw a fading rectangle on these old positions.

But i guess it is more optimized to do it with particles. Not sure what is wrong though.

Re: How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 10:17 pm
by Vimm
Sulunia wrote:I never really messed with the particle systems. Usually i just create a table with past values and draw a fading rectangle on these old positions.

But i guess it is more optimized to do it with particles. Not sure what is wrong though.
That kinda what i wanted to do, but I couldnt make it work either lol

Re: How do you make a trail behind a rectangle?

Posted: Fri Apr 08, 2016 10:41 pm
by Sulunia
Check the example attached.

Although i'm going to create a nice WARNING here and say this is probably not the best way of doing this, since i believe the particle system is more optimized. However, it works, and i do the same thing in beatfever since i'm lazy.

Re: How do you make a trail behind a rectangle?

Posted: Sat Apr 09, 2016 12:13 am
by Vimm
Sulunia wrote:Check the example attached.

Although i'm going to create a nice WARNING here and say this is probably not the best way of doing this, since i believe the particle system is more optimized. However, it works, and i do the same thing in beatfever since i'm lazy.
Yeah thats exactly how I wanted to do it, ill have to practice that code haha. Doesnt help that I'm new to lua as well as LOVE ahaha