Difference between revisions of "Effect file"

From Serious Sam's Bogus Detour
Jump to: navigation, search
Line 17: Line 17:
  
 
===Expression language===
 
===Expression language===
 +
====Parameters====
 +
There are four built in parameters for effects,
 +
{| class="wikitable"
 +
|t
 +
|time
 +
|0-1
 +
|-
 +
|l
 +
|loop
 +
|0+
 +
|-
 +
|u
 +
|unit
 +
|Not 0
 +
|-
 +
|i
 +
|index
 +
|0+
 +
|}
 +
 +
The '''time''' parameter says where in the effect "timeline" you are, so it goes from 0 to 1 over the length of the effect, if the effect is looping then when '''time''' hits 1 it will reset to 0 and '''loop''' will increase by 1. So an expression like,
 +
    t + l
 +
will simply start at 0 and go up forever until the effect is stopped.
 +
 +
The '''unit''' parameter simply contains the unit id for the unit that is currently playing the effect, this is fairly unique but can be reused for future effects getting played.
 +
 +
And the '''index''' parameter only exists inside a trail effect component and simply contains the id of the current segment in the trail.
 +
 +
More parameters can be added to an effect using the <param> tag and has to be filled with values by scripts.
 +
 +
 +
 
====Functions====
 
====Functions====
 
sin
 
sin

Revision as of 21:41, 17 April 2017

.effect


File format

Sprite

Light

Trail

Param

These are values that can be sent to the effect and used in the effect expressions, for example these are used to send in an angle to most projectiles and rotate their sprites accordingly.

   <param name="angle" default="0" />

Variation

Data

Expression language

Parameters

There are four built in parameters for effects,

t time 0-1
l loop 0+
u unit Not 0
i index 0+

The time parameter says where in the effect "timeline" you are, so it goes from 0 to 1 over the length of the effect, if the effect is looping then when time hits 1 it will reset to 0 and loop will increase by 1. So an expression like,

   t + l

will simply start at 0 and go up forever until the effect is stopped.

The unit parameter simply contains the unit id for the unit that is currently playing the effect, this is fairly unique but can be reused for future effects getting played.

And the index parameter only exists inside a trail effect component and simply contains the id of the current segment in the trail.

More parameters can be added to an effect using the <param> tag and has to be filled with values by scripts.


Functions

sin

cos

abs

ceil

floor

exp

log

saturate

sign

sqrt

clamp

lerp

min

max

smoothstep

pow

rand

wposx

wposy