Golem Particle has come back! After adding many new functions and polishing previous ones, I’ve upgraded Golem Particle. Before, there were many functions that were imperfect, or required unnecessary typing to do. I’ve changed it so that you have to use a minimal amount of code to make pretty good particle effects. You will need the Transition Library by TimeSpaceMagic, if you have it already, duplicate it and save it as “transitions.lua”. You must do this because you can interfere with Golem Particle’s transitions if you cancel all transitions or pause them all. Documentation of Golem Particle is given below.
Getting Started:
To start using Golem Particle, put this at the top of the scene you’ll use it in:
[lua]local gp=require(“golem_particle”)[/lua]
That way, you can use all the functions from it.
RADIAL VENTS:
A Radial Vent has particles that start at the center and then move within a radius.
Making the vent:
[lua]local myRadialVent=gp.newRadialVent{
–“shape” parameter:
shape={“rect”, 20, 20}, --> Particles are rectangles, 20x20
–shape={“circle”, 5, 10} --> Particles are circles with a random radius from 5 pixels to 10 pixels
–shape={“image”, “myParticleImage.png”, 10, 10} --> Particles are “myParticleImage.png” image rectangles, 10x10
–“radius” parameter:
radius=150, --> Particles must be inside a radius of 150
–“ventSpeed” parameter:
ventSpeed=100, --> Vent makes new burst of particles every 100 milliseconds
–“particleSpeed” parameter:
particleSpeed=1000, --> Particles take 1000 milliseconds to reach their destination
–“numParticles” parameter:
numParticles=10, --> Every burst will make 10 particles
–“life” parameter:
life=1500, --> It will take 1500 milliseconds for the particle to reach the endScale and endAlpha and be destroyed
–“endAlpha” parameter:
endAlpha=0, --> Alpha the particle will be when it is destroyed
–“endScale” parameter
endScale={0.5, 0.5} --> xScale and yScale the particle will be when it is destroyed
}[/lua]
Functions for Radial Vents:
“setParticleColor” function:
[lua] myRadialVent:setParticleColor(255,255,255) --> Particles are white
–myRadialVent:setParticleColor(255,255,255,80) --> Particles are white with 80 alpha
–Random fillColors:
–myRadialVent:setParticleColor(0,255, 0,255, 0,255) --> Particles have random color, bounds are in pairs
–myRadialVent:setParticleColor(255,255, 100,255, 255,255) --> Particles have 255 red, a random value from 100 to 255 green, and 255 blue
–myRadialVent:setParticleColor(85,150, 255,255, 255,255, 0,255) --> Particles have a random value from 85 to 150 red, 255 green, 255 blue, and a random value from 0 to 255 alpha
–myRadialVent:setParticleColor() --> Entirely random[/lua]
“setParticleShape” function:
[lua] myRadialVent:setParticleShape{
–Can set same parameters as “shape” parameter in newRadialVent function
–You have to re-activate the vent with “activate” for changes to take effect
}[/lua]
Note: All values can be changed like this:
[lua] myRadialVent.endAlpha=1.0[/lua]
“activate” function:
[lua] myRadialVent:activate() --> Begin spawning particles![/lua]
“deactivate” function:
[lua] myRadialVent:deactivate() --> Stop spawning particles[/lua]
PHYSICS VENTS:
A physics vent (ironically) does not use physics. But you can customize it so that it looks like it does. Create fountains, flares, or whatever that has a physics effect.
Making the vent:
[lua]local myPhysicsVent=gp.newPhysicsVent{
–“shape” parameter:
shape={“rect”, 20, 20}, --> Particles are rectangles, 20x20
–shape={“circle”, 5, 10} --> Particles are circles with a random radius from 5 pixels to 10 pixels
–shape={“image”, “myParticleImage.png”, 10, 10} --> Particles are “myParticleImage.png” image rectangles, 10x10
–“ventSpeed” parameter:
ventSpeed=100, --> Vent makes new burst of particles every 100 milliseconds
–“numParticles” parameter:
numParticles=10, --> Every burst will make 10 particles
–“forceX” parameter:
forceX=15, --> Amount of movement to either side the particle will start with
–“growthRate” parameter:
growthRate=5, --> A little “boost” for the forceX
–“gravity” parameter:
gravity={0, 4}, --> It is what it says, first value is x, second value is y
–“initForce” parameter:
initForce={10, 30}, --> How high up it will fly (in random bounds), negative values make force go down
–“life” parameter:
life=1500, --> It will take 1500 milliseconds for the particle to reach the endScale and endAlpha and be destroyed
–“endAlpha” parameter:
endAlpha=0, --> Alpha the particle will be when it is destroyed
–“endScale” parameter
endScale={0.5, 0.5} --> xScale and yScale the particle will be when it is destroyed
}[/lua]
Functions for Physics Vents:
“setParticleColor” function:
[lua] myPhysicsVent:setParticleColor(255,255,255) --> Particles are white
–myPhysicsVent:setParticleColor(255,255,255,80) --> Particles are white with 80 alpha
–Random fillColors:
–myPhysicsVent:setParticleColor(0,255, 0,255, 0,255) --> Particles have random color, bounds are in pairs
–myPhysicsVent:setParticleColor(255,255, 100,255, 255,255) --> Particles have 255 red, a random value from 100 to 255 green, and 255 blue
–myPhysicsVent:setParticleColor(85,150, 255,255, 255,255, 0,255) --> Particles have a random value from 85 to 150 red, 255 green, 255 blue, and a random value from 0 to 255 alpha
–myPhysicsVent:setParticleColor() --> Entirely random[/lua]
Note: All values can be changed like this:
[lua] myPhysicsVent.ventSpeed=1000[/lua]
“setParticleShape” function:
[lua] myPhysicsVent:setParticleShape{
–Can set same parameters as “shape” parameter in newPhysicsVent function
–You have to re-activate the vent with “activate” for changes to take effect
}[/lua]
“activate” function:
[lua] myPhysicsVent:activate() --> Begin spawning particles![/lua]
“deactivate” function:
[lua] myPhysicsVent:deactivate() --> Stop spawning particles[/lua]
Enjoy!
[import]uid: 147322 topic_id: 28387 reply_id: 328387[/import]
