There are a few problems with this.
First of all, create the image once, outside the draw loop. Better, do it in love.load callback.
Second, the update method should be called in love.update callback, to be updated every frame.
Third, you might want to make use of
setEmissionRate()
Fourth, you forgot to draw it.
Code: Select all
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
And in case you want to set the position of it where you are clicking with the mouse, make use of love.mousepressed callback.
Code: Select all
function love.mousepressed(x,y,button)
particlesystem:setPosition(x+math.random(-10,10),y+math.random(-10,10))
end
Hope this helps.
Note: We have
an etiquette which recommends to use code tags when posting code.