New ParticleSystem stuff!
(I'm no expert, so please correct me if I say something wrong!)
There is
AreaSpreadAngle, which rotates the emission area rectangle/ellipse.
There are two new AreaSpread distributions,
'borderrectangle' and
'borderellipse', which emit particles from the border of the rectangle/ellipse instead of within it.
There is
AreaSpreadIsRelativeDirection, which (I think) gives particles a direction based on where they were emitted in the emission area, i.e. if the particle was emitted in the upper-left of the emission area it will move up and left. The direction set by setDirection will set a direction relative to this direction, i.e. if the direction is 0 radians then the particles will move outward from the emitter as described before, and a direction of pi radians will move the particles inward toward the emitter.
- ps.love
- (1.56 KiB) Downloaded 178 times
Code: Select all
function love.load()
square = love.graphics.newImage('square.png')
ps = love.graphics.newParticleSystem(square, 1000)
ps:setPosition(400, 300)
ps:setEmissionRate(200)
ps:setParticleLifetime(2)
ps:setSizes(1, 0)
ps:setSpeed(100)
areaX = 160
areaY = 80
areaAngle = 1
ps:setAreaSpread('borderrectangle', areaX, areaY)
ps:setAreaSpreadAngle(areaAngle)
ps:setDirection(0)
ps:setAreaSpreadIsRelativeDirection(true)
end
function love.update(dt)
ps:update(dt)
end
function love.draw()
love.graphics.draw(ps, 0, 0)
end
Image by lognz, which you'll probably need to right click on and open in a new tab to read clearly.
love.mousepressed and
love.mousereleased now have a click count argument which is the number of clicks in quick succession.
Code: Select all
function love.mousepressed(x, y, button, isTouch, clickCount)
print(clickCount)
end
I think this uses the system's "double click" speed, so I guess its main use case is checking for double clicks.
Making an Image from an ImageData errors for me (it works fine in 0.10.2):
Code: Select all
image = love.graphics.newImage('image.png') -- This is fine
imagedata = love.image.newImageData('image.png')
image = love.graphics.newImage(imagedata) -- This errors
Code: Select all
Error
main.lua:3: Could not decode data to ImageData: unsupported encoded format
Traceback
[C]: in function 'newImage'
main.lua:3: in main chunk
[C]: in function 'require'
[C]: in function 'xpcall'