Page 1 of 1

Help with particle system

Posted: Tue Feb 11, 2014 2:29 am
by uesports135
I'm looking for a very simple particle system that I can play around with so I can learn it. I've tried making one myself I've found on another forum but it doesn't work. When I use the following code I get an error - attempt to call method 'setParticleLife' (a nil value)

When I take that line out, nothing seems to happen at all. What am I doing wrong?

local image, particlesystem

function love.load()
image = love.graphics.newImage("Electisock.png")
particlesystem = love.graphics.newParticleSystem(image,8)
particlesystem:setEmissionRate(3)
particlesystem:setParticleLife(5)
particlesystem:setSizes(1.0, 0.8, 0.4, 0.1)
particlesystem:start()
end

function love.update(dt)
particlesystem:update(dt)
end

function love.draw()
love.graphics.draw(particlesystem,100,100)
end

Re: Help with particle system

Posted: Tue Feb 11, 2014 2:53 am
by ejmr
The method name is setParticleLifetime().

Re: Help with particle system

Posted: Tue Feb 11, 2014 7:21 am
by Plu
Maybe this can help you?

http://love2d.org/forums/viewtopic.php? ... le#p161206

It lets you make particles with an editor and then generates the neccesary code so you can see how they work.

Re: Help with particle system

Posted: Tue Feb 11, 2014 3:17 pm
by uesports135
Awesome, thanks guys