Help with particle system

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
uesports135
Prole
Posts: 2
Joined: Tue Feb 11, 2014 2:23 am

Help with particle system

Post 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
User avatar
ejmr
Party member
Posts: 302
Joined: Fri Jun 01, 2012 7:45 am
Location: South Carolina, U.S.A.
Contact:

Re: Help with particle system

Post by ejmr »

The method name is setParticleLifetime().
ejmr :: Programming and Game-Dev Blog, GitHub
南無妙法蓮華經
User avatar
Plu
Inner party member
Posts: 722
Joined: Fri Mar 15, 2013 9:36 pm

Re: Help with particle system

Post 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.
uesports135
Prole
Posts: 2
Joined: Tue Feb 11, 2014 2:23 am

Re: Help with particle system

Post by uesports135 »

Awesome, thanks guys
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 2 guests