Particles.lua

Download Latest Version

Particles is a library designed to create particle effects for LunaLua. There are some built-in effects, but effects can be altered or added using configurable .ini files. Particles require the use of OpenGL.

Installation
Place the file particles.lua and the folder particles into the LuaScriptsLib folder.

How to use
To enable the Particles library for a specific level, add this line to lunadll.lua: This will load the Particle API. From there, you can create emitters from .ini files and draw particle effects into the scene.

Example
This will create a small flame effect at coordinates (-199300,-200000) and draw it to the screen.

Full screen effects need to be attached to the camera as well:

This will create a rain effect and snap it to player 1's camera, allowing the effect to follow the screen.

Classes
These are classes contained within this library.

Emitter
''A source object for particle effects. This contains the definition of a particle system.''

Values

Functions

Ribbon
''A source object for ribbon trails. This contains the definition of a ribbon trail.''

Values

Functions

Col
A colour object, containing RGBA values

Values

Operators

Grad
A gradient object, defining linear-interpolated gradients of colours or numbers

Functions

PointField
A force field object that can affect the movement of particles, defined by a single point of attraction or repulsion with an effect radius and falloff

Values

Functions

LineField
A force field object that can affect the movement of particles, defined by a line segment of attraction or repulsion with an effect radius and falloff

Values

Functions

External Use Functions
These are functions you will need to use the library

Configuration Files
Documentation for the .ini configuration files that can be used by the library.

Types
Some types are only used by Ribbon emitters. These are listed here:

Values
Ribbon Trails use a different, smaller set of values, which are listed here:

Ribbon Values
To assign these values, simply use the syntax:

These ini files also support simple variables, so long as the variable is defined earlier in the ini file. For example:

...is valid.

Comments can be applied using the Lua   notation. For example: