I'm starting simple, and making a little asteroids clone. I've got the ship movement working nicely, and want to add a kind of exhaust trail using particles.
I want them to be created at the player's position, and then shoot off backwards. Unfortunately, all of the particles always seem to follow the player object, whereas I only want the emitter to.
What am I doing wrong?
Any help much appreciated
btw: I looked at the Particles demo, but all the stuff for changing modes makes it too complicated to learn the basics from.
Here's my code (minus the stuff to do with the player object)
Code: Select all
function load()
-- Load particle sprite.
particleSprite = love.graphics.newImage( "Particle.png" )
-- Create new particle system.
particles = love.graphics.newParticleSystem( particleSprite, 1000 )
particles: setEmissionRate( 30 )
particles: setLifetime( -1 )
particles: setParticleLife( 3 )
end
function draw()
-- Draw particles at player position.
love.graphics.draw( particles, player.xPos , player.yPos )
end
function update(dt)
-- Update particle system.
particles: setDirection( player.angle )
particles: setPosition( player.xPos, player.yPos )
particles: setSpeed( 20 )
particles: update( dt )
end