Difference between revisions of "ParticleSystem"
Luke100000 (talk | contribs) (Added Hot Particles particle editor to list) |
|||
(17 intermediate revisions by 10 users not shown) | |||
Line 1: | Line 1: | ||
− | + | A ParticleSystem can be used to create particle effects like fire or smoke. | |
− | The particle | + | |
− | using | + | The particle system has to be created using [[love.graphics.newParticleSystem]]. Just like any other [[Drawable]] it can be drawn to the screen using [[love.graphics.draw]]. You also have to [[ParticleSystem:update|update]] it in the [[love.update|update callback]] to see any changes in the particles emitted. |
− | + | ||
− | in the particles emitted. | + | The particle system won't create any particles unless you call [[ParticleSystem:setParticleLifetime|setParticleLifetime]] and [[ParticleSystem:setEmissionRate|setEmissionRate]]. |
+ | |||
+ | == Constructors == | ||
+ | {{#ask: [[Category:Functions]] [[Constructs::ParticleSystem]] [[Concept:Current]] | ||
+ | | headers=hide | ||
+ | | default=None. | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | }} | ||
== Functions == | == Functions == | ||
− | {{#ask: [[Category:Functions]] [[parent::ParticleSystem]] | + | {{#ask: [[Category:Functions]] [[parent::ParticleSystem||Drawable||Object]] [[Concept:Current]] |
| headers=hide | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
+ | | limit=2000 | ||
| ?Description | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
+ | | ?PrettyDeprecated | ||
}} | }} | ||
− | {{#ask: [[Category: | + | == Enums == |
+ | {{#ask: [[Category:Enums]] [[parent::ParticleSystem||Drawable||Object]] [[Concept:Current]] | ||
| headers=hide | | headers=hide | ||
+ | | format=template | ||
+ | | template=ListingFields | ||
+ | | introtemplate=ListingIntro | ||
+ | | outrotemplate=ListingOutro | ||
| ?Description | | ?Description | ||
+ | | ?PrettySince | ||
+ | | ?PrettyRemoved | ||
}} | }} | ||
== Supertypes == | == Supertypes == | ||
− | [[Drawable]] | + | * [[parent::Drawable]] |
+ | * [[parent::Object]] | ||
== See Also == | == See Also == | ||
* [[parent::love.graphics]] | * [[parent::love.graphics]] | ||
− | |||
[[Category:Types]] | [[Category:Types]] | ||
− | {{#set:Description=Used to create cool effects, like fire. | + | {{#set:Description=Used to create cool effects, like fire.}} |
− | }} | + | {{#set:Since=000}} |
+ | Particle editors: | ||
+ | * https://love2d.org/forums/viewtopic.php?f=4&t=2110 | ||
+ | * https://love2d.org/forums/viewtopic.php?f=5&t=32954 | ||
+ | * https://love2d.org/forums/viewtopic.php?f=5&t=76986 | ||
+ | * https://love2d.org/forums/viewtopic.php?f=5&t=88860 | ||
+ | |||
== Other Languages == | == Other Languages == | ||
{{i18n|ParticleSystem}} | {{i18n|ParticleSystem}} |
Latest revision as of 20:20, 13 July 2023
A ParticleSystem can be used to create particle effects like fire or smoke.
The particle system has to be created using love.graphics.newParticleSystem. Just like any other Drawable it can be drawn to the screen using love.graphics.draw. You also have to update it in the update callback to see any changes in the particles emitted.
The particle system won't create any particles unless you call setParticleLifetime and setEmissionRate.
Constructors
love.graphics.newParticleSystem | Creates a new ParticleSystem. |
Functions
Object:release | Immediately destroys the object's Lua reference. | 11.0 | |
Object:type | Gets the type of the object as a string. | ||
Object:typeOf | Checks whether an object is of a certain type. | ||
ParticleSystem:clone | Creates an identical copy of the ParticleSystem in the stopped state. | 0.9.1 | |
ParticleSystem:count | Gets the amount of particles that are currently in the system. | 0.9.0 | |
ParticleSystem:emit | Emits a burst of particles from the particle emitter. | 0.9.0 | |
ParticleSystem:getAreaSpread | Gets the area-based spawn parameters for the particles. | 0.9.0 | 11.0 |
ParticleSystem:getBufferSize | Gets the maximum number of particles the ParticleSystem can have at once. | 0.9.0 | |
ParticleSystem:getColors | Gets the colors to apply to the particle sprite. | 0.9.0 | |
ParticleSystem:getCount | Gets the number of particles that are currently in the system. | 0.9.0 | |
ParticleSystem:getDirection | Gets the direction of the particle emitter (in radians). | ||
ParticleSystem:getEmissionArea | Gets the area-based spawn parameters for the particles. | 11.0 | |
ParticleSystem:getEmissionRate | Gets the amount of particles emitted per second. | 0.9.0 | |
ParticleSystem:getEmitterLifetime | Gets how long the particle system will emit particles | 0.9.0 | |
ParticleSystem:getImage | Gets the image used for the particles. | 0.9.0 | 0.10.0 |
ParticleSystem:getInsertMode | Gets the mode used when the ParticleSystem adds new particles. | 0.9.0 | |
ParticleSystem:getLinearAcceleration | Gets the linear acceleration (acceleration along the x and y axes) for particles. | 0.9.0 | |
ParticleSystem:getLinearDamping | Gets the amount of linear damping (constant deceleration) for particles. | 0.9.2 | |
ParticleSystem:getOffset | Gets the particle image's draw offset. | 0.9.0 | |
ParticleSystem:getOffsetX | Get the x coordinate of the particle rotation offset. | 0.9.0 | |
ParticleSystem:getOffsetY | Get the y coordinate of the particle rotation offset. | 0.9.0 | |
ParticleSystem:getParticleLifetime | Gets the lifetime of the particles. | 0.9.0 | |
ParticleSystem:getPosition | Gets the position of the emitter. | ||
ParticleSystem:getQuads | Gets a series of Quads used for the particle sprites. | 0.9.2 | |
ParticleSystem:getRadialAcceleration | Gets the radial acceleration (away from the emitter). | 0.9.0 | |
ParticleSystem:getRotation | Gets the rotation of the image upon particle creation (in radians). | 0.9.0 | |
ParticleSystem:getSizeVariation | Gets the amount of size variation. | 0.9.0 | |
ParticleSystem:getSizes | Gets the sizes of the particle over its lifetime. | 0.9.0 | |
ParticleSystem:getSpeed | Gets the speed of the particles. | 0.9.0 | |
ParticleSystem:getSpin | Gets the spin of the sprite. | 0.9.0 | |
ParticleSystem:getSpinVariation | Gets the amount of spin variation. | 0.9.0 | |
ParticleSystem:getSpread | Gets the amount of directional spread of the particle emitter (in radians). | ||
ParticleSystem:getTangentialAcceleration | Gets the tangential acceleration (acceleration perpendicular to the particle's direction). | 0.9.0 | |
ParticleSystem:getTexture | Gets the texture (Image or Canvas) used for the particles. | 0.9.1 | |
ParticleSystem:getX | Gets the x-coordinate of the particle emitter's position. | 0.9.0 | |
ParticleSystem:getY | Gets the y-coordinate of the particle emitter's position. | 0.9.0 | |
ParticleSystem:hasRelativeRotation | Gets whether particle angles and rotations are relative to their velocities. | 0.9.1 | |
ParticleSystem:isActive | Checks whether the particle system is actively emitting particles. | ||
ParticleSystem:isEmpty | Checks whether the particle system is empty of particles. | 0.9.0 | |
ParticleSystem:isFull | Checks whether the particle system is full of particles. | 0.9.0 | |
ParticleSystem:isPaused | Checks whether the particle system is paused. | 0.9.0 | |
ParticleSystem:isStopped | Checks whether the particle system is stopped. | 0.9.0 | |
ParticleSystem:moveTo | Moves the position of the emitter. | 0.9.1 | |
ParticleSystem:pause | Pauses the particle emitter. | ||
ParticleSystem:reset | Resets the particle emitter, removing existing particles and resetting the lifetime counter. | ||
ParticleSystem:setAreaSpread | Sets area-based spawn parameters for the particles. | 0.9.0 | 11.0 |
ParticleSystem:setBufferSize | Sets the size of the buffer (the max allowed amount of particles in the system). | ||
ParticleSystem:setColor | Sets the color of the image. | 0.8.0 | |
ParticleSystem:setColors | Sets the colors to apply to the particle sprite. | 0.8.0 | |
ParticleSystem:setDirection | Sets the direction the particles will be emitted in. | ||
ParticleSystem:setEmissionArea | Sets area-based spawn parameters for the particles. | 11.0 | |
ParticleSystem:setEmissionRate | Sets the amount of particles emitted per second. | ||
ParticleSystem:setEmitterLifetime | Sets how long the particle system should emit particles | 0.9.0 | |
ParticleSystem:setGravity | Sets the gravity affecting the particles (acceleration along the y-axis). | 0.9.0 | |
ParticleSystem:setImage | Sets the image to be used for the particles. | 0.9.0 | 0.10.0 |
ParticleSystem:setInsertMode | Sets the mode to use when the ParticleSystem adds new particles. | 0.9.0 | |
ParticleSystem:setLifetime | Sets how long the particle system should emit particles (if -1 then it emits particles forever). | 0.9.0 | |
ParticleSystem:setLinearAcceleration | Sets the linear acceleration (acceleration along the x and y axes) for particles. | 0.9.0 | |
ParticleSystem:setLinearDamping | Sets the amount of linear damping (constant deceleration) for particles. | 0.9.2 | |
ParticleSystem:setOffset | Set the offset position which the particle sprite is rotated around. | ||
ParticleSystem:setParticleLife | Sets the life of the particles. | 0.9.0 | |
ParticleSystem:setParticleLifetime | Sets the lifetime of the particles. | 0.9.0 | |
ParticleSystem:setPosition | Sets the position of the emitter. | ||
ParticleSystem:setQuads | Sets a series of Quads to use for the particle sprites. | 0.9.2 | |
ParticleSystem:setRadialAcceleration | Set the radial acceleration (away from the emitter). | ||
ParticleSystem:setRelativeRotation | Sets whether particle angles and rotations are relative to their velocities. | 0.9.1 | |
ParticleSystem:setRotation | Sets the rotation of the image upon particle creation (in radians). | ||
ParticleSystem:setSize | Sets the size of the particle (1.0 being normal size). | 0.8.0 | |
ParticleSystem:setSizeVariation | Sets the amount of size variation. | ||
ParticleSystem:setSizes | Sets the sizes of the particle over its lifetime. | 0.8.0 | |
ParticleSystem:setSpeed | Sets the speed of the particles. | ||
ParticleSystem:setSpin | Sets the spin of the sprite. | ||
ParticleSystem:setSpinVariation | Sets the amount of spin variation. | ||
ParticleSystem:setSpread | Sets the amount of spread for the system. | ||
ParticleSystem:setSprite | Sets the image which is to be emitted. | 0.9.0 | |
ParticleSystem:setTangentialAcceleration | Sets the tangential acceleration (acceleration perpendicular to the particle's direction). | ||
ParticleSystem:setTexture | Sets the texture (Image or Canvas) to be used for the particles. | 0.9.1 | |
ParticleSystem:start | Starts the particle emitter. | ||
ParticleSystem:stop | Stops the particle emitter, resetting the lifetime counter. | ||
ParticleSystem:update | Updates the particle system; moving, creating and killing particles. |
Enums
AreaSpreadDistribution | Types of particle area spread distribution. | 0.9.0 | |
ParticleInsertMode | How newly created particles are added to the ParticleSystem. | 0.9.0 |
Supertypes
See Also
Particle editors:
- https://love2d.org/forums/viewtopic.php?f=4&t=2110
- https://love2d.org/forums/viewtopic.php?f=5&t=32954
- https://love2d.org/forums/viewtopic.php?f=5&t=76986
- https://love2d.org/forums/viewtopic.php?f=5&t=88860
Other Languages
Dansk –
Deutsch –
English –
Español –
Français –
Indonesia –
Italiano –
Lietuviškai –
Magyar –
Nederlands –
Polski –
Português –
Română –
Slovenský –
Suomi –
Svenska –
Türkçe –
Česky –
Ελληνικά –
Български –
Русский –
Српски –
Українська –
עברית –
ไทย –
日本語 –
正體中文 –
简体中文 –
Tiếng Việt –
한국어
More info