Parallaxing background elements give the illusion of depth for elements that appear to face upwards or downwards. Parallaxing background elements may consist of a single sprite specified by the spriteno parameter. In Version 1.1 and higher, parallax elements may be animated by specifying actionno like in ordinary animated background elements. Animated parallax may not be used with the xscale parameter.
An example of the format is as follows:
[BG my_parallax_element]Another example:
type = parallax
spriteno = 10, 0
width = 300, 600
scalestart = 1,1
scaledelta = 0,.001
[BG my_parallax_element]Parameter descriptions follow:
type = parallax
spriteno = 10, 0
xscale = 1,1.5
yscalestart = 100 ;Deprecated!
yscaledelta = 1.2 ;Deprecated!
width = top_width, bottom_width ; (int, int) top_width and bottom_width respectively specify the top and bottom widths of a trapezoid that has the same height as the sprite used. The sprite will be distorted to match the shape and size of the trapezoid. The ratio of top_width to bottom_width affects the amount of shearing as the camera moves horizontally. Use width if the sprite is not preprocessed for perspective distortion. For historical reasons, the x-axis specified in the SFF is ignored. The horizontal center of the sprite is used as the x-axis instead.
xscale = top_xscale, bottom_xscale ; (float, float) top_xscale and bottom_xscale respectively scale the horizontal delta of the background element's top and bottom edge to create a horizontal shearing effect. For example, delta = .75, .75 amd xscale = 1, 2 specifies the top of the sprite would move at .75 * 1 = .75 stage units per camera unit, and the bottom would move at .75 * 2 = 1.5 stage units per camera unit. This example assumes the sprite axis is at the top of the sprite.
Either xscale or width is required, but not both at the same time. Use xscale if the sprite has already been preprocessed for perspective distortion. Hardware accelerated rendering will have visual artifacts at extreme shear angles.
Animated parallax may not be used when xscale is used.
yscalestart = yscalestart ; (float) This deprecated parameter controls the change in vertical scale of the element as the camera moves vertically. Its functionality is replaced by the general-purpose scalestart and scaledelta advanced parameters.
yscalestart is the inverse of the vertical scale of the sprite when the camera is at ground level, represented in percentage. For example, a value of 100 corresponds to a scale factor of 1, and 50 corresponds to a scale factor of 2. The value defaults to 100.
yscaledelta = yscaledelta ; (float) Specifies the amount to add from the inverted scale factor for every camera unit the camera moves down, represented in percentage. The final scale factor is calculated using the following formula:
scale = 1 / (yscalestart/100 + yscaledelta/100 * camera_y)
In the example above, if the camera moves up by one unit, the scale factor will be 1 / (1.00 + .012 * -1) = 1.012, and if it moves up another unit, the scale will be 1 / (1.00 + .012 * -2) = 1.025 and so on.
The unintuitive behavior for the yscalestart and yscaledelta parameters is the reason for deprecating these parameters in favor of the scalestart and scaledelta parameters.
1.1b and higher
scalestart = scale_x, scale_y ; (float, float) Starting scale. Defaults to 1,1.
scaledelta = scale_dx, scale_dy ; (float, float) Similar to the delta parameter, this is the amount to change the scale of the element for each unit of camera movement. Defaults to 0,0.
Other parameters for static elements are also valid for parallax elements, with the exception of tilespacing. Additionally, y_tile is ignored and forced to be 0.
The result of specifying an angle in an animated parallax element is undefined.
The software renderer does not support animated parallax.