-
Notifications
You must be signed in to change notification settings - Fork 1
Documentation
ParticleSytem
This class create a particle system for manage your particles.
public ParticleSystem(int type, World world, Camera camera)
type
: Particles type. See Particle types
world
: If you want collisions between particles and others object put your box2D world. If not put null
.
camera
: For show particles and calculate if particles are outside the screen.
public void setTexture(ParticleTexture texture)
Set particles texture through ParticleTexture
object.
Only works for TEXTURE and HALO type. See Particle types
public void setRules(ParticleRules rules)
Set particles rules. See ParticleRules
public void setPhysicManager(PhysicManager physicManager)
Set particles physics. See PhysicManager
public PhysicManager getPhysicManager()
Get particles physics. See PhysicManager
public void setParticlesPosition(float x, float y)
Set the first position of particles. If you modify this, it won't affect existing particles but futures.
public void dispose()
Free memory
public void render()
Render particles
public void enableBlending()
public void disableBlending()
public boolean isBlendingEnabled()
public int getBlendDstFunc()
public int getBlendSrcFunc()
public int getBlendSrcFuncAlpha()
public int getBlendDstFuncAlpha()
public void disableBlending(int srcFunc, int dstFunc
public void setBlendFunctionSeparate(int srcFuncColor, int dstFuncColor, int srcFuncAlpha, int dstFuncAlpha)
Blending functions for the sprite batch.
This particle type has a base texture. However you can set a custom texture. The difference with TEXTURE type is that the texture will be tinted with light color.
ParticleType.HALO
For use custom texture.
ParticleType.TEXTURE
For only show the light.
ParticleType.NOTHING
ParticleRules
public ParticleRules()
public void setLife(ParticleLife life)
Set life of particles with ParticleLife
object.
public void setNumber(ParticleEmissionNumber number)
Set number of particles emitted with ParticleEmissionNumber
object.
public void setDuration(ParticleEmissionDuration duration)
Set duration of emission with ParticleEmissionDuration
object.
public void setLight(ParticleEmissionLight light)
Set light of particles with ParticleEmissionLight
object.
ParticleTexture
public ParticleTexture(String path)
path
: Path of your texture.
RandomParticleTexture
public RandomParticleTexture()
public void addTexture(Texture texture)
Add a texture to the system
public void removeTexture(Texture texture)
Remove a texture from the system
ParticleEmissionDuration
public ParticleEmissionDuration(float duration)
duration
: Duration of the emission in seconds.
public ParticleEmissionDuration(boolean infinite)
infinite
: Set infinite duration. Always put true
!
public void setDuration(float duration)
Set the duration of emission in seconds
public void setInfinite(boolean infinite)
Set if emission is infinite or not.
ParticleEmissionLight
public ParticleEmissionLight(RayHandler rayHandler, int rays, Color color, float distance)
rayHandler
: Put your RayHandler
here.
rays
: Number of rays that have lights. More is more realistic
color
: Color of the lights
distance
: Distance of the lights
public ParticleEmissionLight()
Use this if you doesn't want to use box2d light!
public ParticleEmissionLight(Color color)
Use this if you doesn't want to use box2d light but tint your particles in HALO mode!
ParticleEmissionLightRandom
public ParticleEmissionLightRandom(RayHandler rayHandler, int rays, Color color, float distance_min, float distance_max)
rayHandler
: Put your RayHandler
here.
rays
: Number of rays that have lights. More is more realistic
color
: Color of the lights
distance_min
: Minimum distance of the lights
distance_max
: Maximum distance of the lights
ParticleEmissionNumber
public ParticleEmissionNumber(int mode, int number)
mode
: Mode of the emission. See Mode below.
number
: Number of particles
public void setDelay(int seconds)
Set a delay in seconds between emission and only with PER_SECONDS
mode!
Number of particles visible in the screen.
ParticleEmissionNumber.INNER_SCREEN
Number of particles emitted per second
ParticleEmissionNumber.PER_SECONDS
ParticleEmissionNumberRandom
public ParticleEmissionNumberRandom(int mode, int min, int max)
mode
: See upper
min
: Minimum number of particles
max
: Maximum number of particles
ParticleLife
public ParticleLife(float life)
life
: Life of particles in seconds
public ParticleLife(float life, boolean outer)
life
: Life of particles in seconds
outer
: If true, particles survive life
seconds outside the screen then die.
ParticleLifeRandom
public ParticleLife(float life_min, float life_max)
life_min
: Minimum life of particles in seconds
life_max
: Minimum life of particles in seconds
public ParticleLifeRandom(float life_min, float life_max, boolean outer)
life_min
: Minimum life of particles in seconds
life_max
: Minimum life of particles in seconds
outer
: If true, particles survive life
seconds outside the screen then die.
PhysicManager
public PhysicManager()
public void addForce(PhysicForce force)
Add force to the physic manager
public void removeForce(PhysicForce force)
Remove force to the physic manager
This is the base class for make forces. See improve this library for more details.
BrownianForce
public BrownianForce(float strength, long seed, double frequency)
strength
: Strength of the force
seed
: Seed of the force
frequency
: Lower means more quiet
public BrownianForce(float strength_x, float strength_y, long seed, double frequency)
strength_x
: Strength of the force for x axis
strength_y
: Strength of the force for y axis
seed
: Seed of the force
frequency
: Lower means more quiet
LinearForce
public LinearForce(float vx, float vy)
vx
: x axis intensity
vy
: y axis intensity
RandomLinearForce
public RandomLinearForce(float vx_min, float vx_max, float vy_min, float vy_max)
vx_min
: Min value for x axis
vx_max
: Max value for x axis
vy_min
: Min value for y axis
vy_max
: Max value for y axis
RadialForce
public RadialForce(float strength)
strength
: Strength of the force
RandomRadialForce
public RandomRadialForce(float strength_min, float strength_max)
strength_min
: Minimum strength of the force
strength_max
: Maximum strength of the force