Difference between revisions of "Particles"

From wiki
Jump to: navigation, search
(Initial commit.)
 
m (Woops left effect instead of particle.)
Line 9: Line 9:
  
  
= Creating a *.effect file =
+
= Creating a *.particle file =
  
 
Creating an effect is fairly easy, though will take work in order to get the particle correct. The following is a file which implements all the options of a particle spawner.
 
Creating an effect is fairly easy, though will take work in order to get the particle correct. The following is a file which implements all the options of a particle spawner.

Revision as of 04:43, 30 May 2017

In Staxel, *.particle files are used to specify a particle spawner. These particle spawners have several properties;

  • Location and Size
  • Speed and size of spawned particles
  • Colour and gravity of particles

Along with more options.


Creating a *.particle file

Creating an effect is fairly easy, though will take work in order to get the particle correct. The following is a file which implements all the options of a particle spawner.

{
  "code" : "mods.yourmodname.particlefilename",
  "angularVelocity" : 0.0,
  "liveDuration" : 1.5,
  "particlesPerSecond" : 120.0,
  "scale" : 0.5,
  "scaleSpread" : 0.0,
  "emitDuration" : 0.0,
  "color" : "ff023CCB",
  "colorSpread" : {"x" : 0.05, "y" : 0.05, "z" : 0.05},
  "emitVelocity" : {"x" : 0.0, "y" : 6.7,  "z" : 0.0},  
  "emitVelocitySpread" : {"x" : 4.5, "y" : 2.5, "z" : 4.5},
  "gravityFactor" : {"x" : 0.0, "y" : -0.25, "z" : 0.0},
  "position" : {"x" : 0.0, "y" : -0.125, "z" : 0.0},
  "positionSpread" : {"x" : 0.5, "y" : 0.05, "z" : 0.5}
}

Once you have created a file like that, you can then specify the code for other files which can play particles, such as Effect files. For info on what each option actually does, look below at #Config Options.


Config Options

"code"

Valid options (String): Any valid string that leads to an item.

Default Value: No default value is specified. Always need to provide your own.


A string containing the code of the item the blob will be referring to.


"angularVelocity"

Valid options (float): A decimal number representing speed.

Default Value: No default value is specified. Always need to provide your own.


This number affects the amount of angular velocity, or the spin, of each particle that is spawned.

"color"

Valid options (Strings): A string of 6 or 8 characters represent the hex code of a colour e.g. #ABC123

Default Value: No default value is specified. Always need to provide your own.


This is the colour of which all particles are spawned with. This takes affect before colour spread.


"colorSpread"

Valid options (Vector3): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies how much the colour should vary. In this case "x" represents the change in Red, "y" Green and "z" Blue. These values are between 0 and 1, 0 being no change in colour, and 1 being able to change to any value.

"emitVelocity"

Valid options (Vector3): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies the initial speed of the velocity along the three axis. Applied before "emitVelocitySpread".


"emitVelocitySpread"

Valid options (Vector3): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies the maximum amount of speed that can be randomly subtracted or added to the initial velocity of the particle when spawned.


"gravityFactor"

Valid options (Vector3): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies the speed at which the particle will change during the time it is alive. For example, a value of "y": 1.0 will make the particle fall downwards.


"liveDuration"

Valid options (Float): A decimal number representing seconds

Default Value: No default value is specified. Always need to provide your own.


This specifies how long a particle will stay "alive". After the amount of seconds specified, the particle will be destroyed. Should be set to a low value in order to avoid players having too many particles to render.


"particlesPerSecond"

Valid options (Float): A decimal number representing seconds

Default Value: No default value is specified. Always need to provide your own.


This specifies how many separate particles will be spawned per second. It can be though of spawning a particle every 1/xth of a second.


"position"

Valid options (Vector3): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies the initial offset of the particle to the tile. Often placing all values to 0.5 will place in the centre of a tile. Though this will change depending on use.


"positionSpread"

Valid options (Vector3): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


This specifies the maximum distance away from the offset the the particle can spawn. For example have a value of "y" : 1 means that a particle can spawn up to 1 tile higher or lower than the actual offset.


"scale"

Valid options (float): A number specifying size

Default Value: No default value is specified. Always need to provide your own.


This specifies scaled size of the spawned particle.


"scaleSpread"

Valid options (float): {"x": 0.0, "y": 0.0, "z": 0.0}

Default Value: No default value is specified. Always need to provide your own.


An additional multiplier that specifies scaled the maximum amount of variance in size. Particles can grow or shrink up to this value.


"emitDuration"

Valid options (Float): A decimal number representing seconds

Default Value: 0.0 (Continue Infinitely)


This specifies how long a particle source will continue to spawn particles. After the amount of seconds has passed, no new particles can spawn. If left as 0, then the particles will continue on infinitely, as long as the thing causing the particles stays in the world.


"emitDuration"

Valid options (Float): A decimal number between 0 and 1

Default Value: 1.0 (Not transparent)


This specifies how opaque a particle will be, with 0 being invisible and 1 being fully visible.


"velocityStretch"

Valid options (Float): A decimal number

Default Value: 0.0 (No stretch)


This specifies how much a particle will stretch because of it's speed.


"positionRotation"

Valid options (Float): A decimal number

Default Value: 0.0 (No rotation)


This specifies how much a particle will be rotated around when spawned.