-
-
Notifications
You must be signed in to change notification settings - Fork 6
Classes
If a function returns multiple values you can get all of them as variables like this:
local x, y = Particle:getPos()
or local x1, y1, x2, y2 = Particle:getBounds()
Arguments in [square brackets] are optional. For example, in setSize(min[, max])
max is optional
Updates and draws that particle system.
Particle is the base class for all particle systems. ParticleCircle is a basic particle system type that can draw circles.
Clears all particles from that particle system.
Removes the particle system from the internal particle table, prepares it for garbage collection.
Property | Default value |
---|---|
particles | {} |
Returns a table of all particles currently in that system.
Creates the specified amount of particles with the current parameters.
The position of the particle system.
Property | Default value |
---|---|
x | 0 |
y | 0 |
Returns the particle system's x and y position.
Moves the particle system to the specified x and y.
Moves the particle system by the specified x and y.
The size of particles from a particle system.
Property | Default value |
---|---|
min | 1 |
max | 1 |
Returns the minimum and maximum size particles from that system can be.
Sets the minimum and maximum size particles from this system will be, or, if only a min is specified the size of all particles from that system.
The angle at which particles can spread from the system.
Property | Default value |
---|---|
min | 0° |
max | 359° |
Returns the minimum and maximum angle particles from that system can move towards.
Sets the minimum and maximum angle particles from that system can move towards or sets the only angle particles from that system can move towards.
The speed particles from that system can move at.
Property | Default value |
---|---|
min | 1 |
max | 1 |
Returns the minimum and maximum possible speed of particles from that system.
Sets the minimum and maximum possible speed of particles from that system or sets the speed of all particles from that system.
The thickness of the lines drawing a particle.
A value of 0 means the particles will be filled in completely
does not affect ParticlePixels
Property | Default value |
---|---|
min | 0 |
max | 0 |
Returns the minimum and maximum thickness of the lines drawing the shapes from that particle system.
Sets the minimum and maximum thickness of the lines drawing the shapes from that particle system or sets the thickness of all lines drawing the shapes from that particle system.
The colour of a particle system's particles.
Property | Default value |
---|---|
colour | playdate.graphics.kColorBlack |
Returns the current colour as an int.
setColor/setColour(colour)
Sets the colour of the particles from that system.
The particle draw mode of a particle system.
Property | Default value |
---|---|
mode | Particles.modes.DISAPPEAR |
Returns the current mode as a value from 0 to 3.
setMode(mode)
Sets the current mode of that particle system to the specified value.
How long a particle will live for
Only used by Particles.modes.DISAPPEAR
Property | Default value |
---|---|
min | 1 |
max | 1 |
Returns the minimum and maximum lifespan particles from that system may last for
Sets the minimum and maximum lifespan of particles from that system or, if only min is specified, the lifespan of all particles from that system.
How much a particle will decay by per frame.
Only used by Particles.modes.DECAY, does not affect ParticlePixels
Property | Default value |
---|---|
decay | 1 |
Returns how much particles decay by every frame.
Sets how much particles decay by every frame.
The boundaries for certain particle modes.
Only used by Particles.modes.LOOP & Particles.modes.STAY
Property | Default value |
---|---|
x1 | 0 |
y1 | 0 |
x2 | 0 |
y2 | 0 |
Returns all 4 values. x1 and y1 for the top left corner, x2 and y2 for the bottom right.
Sets the edges that particles from that system will loop around.
ParticlePoly inherits from Particle so all Particle functions also work with ParticlePolys. ParticlePolys are used to draw shapes with a specific amount of points.
The angular velocity of particles from a particle system.
Property | Default value |
---|---|
min | 0 |
max | 0 |
Returns the possible angular velocity of particles spawned by that particle system.
Set the minimum and maximum angular velocity for particles from that particle system or, if only a min is specified, the angular velocity of all particles in the system.
The starting rotation of the particle system's particles.
Property | Default value |
---|---|
min | 0 |
max | 359 |
Returns the possible starting rotations of the particle system's particles.
Sets the possible starting rotations of the particle system's particles.
The amount of points making up the particle system's shapes.
Property | Default value |
---|---|
min | 3 |
max | 3 |
Returns the amount of points making up the particle system's shapes.
Set the minimum and maximum amount of points for particles from that particle system or, if only a min is specified, the amount of points for all particles in the system.
ParticleImages and ParticleImageBasics are both used to draw regular images as particles. ParticleImage is capable of rotating images while ParticleImageBasic is more performant. All Particle functions work for ParticleImages, however they are not affected by thickness or colour.
The angular velocity of particles from a particle system. Does not affect ParticleImageBasics
Property | Default value |
---|---|
min | 0 |
max | 0 |
Returns the possible angular velocity of particles spawned by that particle system.
Set the minimum and maximum angular velocity for particles from that particle system or, if only a min is specified, the angular velocity of all particles in the system.
The starting rotation of the particle system's particles.
Property | Default value |
---|---|
min | 0 |
max | 359 |
Returns the possible starting rotations of the particle system's particles.
Sets the possible starting rotations of the particle system's particles.
The image for all particles from that system.
Property | Default Value |
---|---|
image | image |
Returns the current image for the system's particles.
Sets the current image for the system's particles. Sets the current imageTable to nil.
Multiple images to randomly be chosen from as a particle's image.
Property | Default Value |
---|---|
table | nil |
Returns the current imageTable used by the particle system.
Sets the particle system's imageTable to table. Sets the particle system's image to nil.
All particle modes, set with setMode(Particles.modes.MODENAME).
Property | Description | Value |
---|---|---|
DISAPPEAR | Particles will move as long as their lifetime is > 0. (Lifespan decreases by .1 evey frame) | 0 |
DECAY | Particles will move as long as their size is > 0. (Size decreases by decay every frame) | 1 |
LOOP | Particles will not disappear unless clearParticles or clearAll is called. If bounds are given, particles will loop between them. | 2 |
STAY | Particles will not disappear unless clearParticles is called, clearAll is called, or, if bounds are given, when they leave them. | 3 |
Updates all particle systems.
Clears all particle systems (does not delete them, only removes their particles).
Removes all particle systems from the internal particle table and prepares them for garbage collection.
Some values like speed would work with numbers below 1 but because of Lua's math.random function it requires integers. These values are multiplied by the precision value so if you set it to 0.1 then setting the speed to 12 would actually give you a speed of 1.2
Property | Default Value |
---|---|
prec | 1 |
Gets the precision value
Sets the precision value
If you would like to donate to me you can here. If you want to reach out to me for any reason feel free to email me or send a message in my Discord server. Thank you :)