Backgrounds (BGs) are elements used by Stages, Storyboards, System Screens and Fight Screen. As the name implies, this kind of element is meant to be in the back of others, as the background. But, the fun fact is that it also means foreground if used on layers 1 or 2.
The syntax for BGs is one BGDef section, followed by multiple BG, BGCtrlDef, BGCtrl and Begin Action (for Animations) sections.
[{Type}BGDef]
- spr: Sprites filename to be used by [BG] elements.
- bgclearcolor: Color to clear the screen before drawing BGs. Format: R, G, B (comma separated integer values from 0 to 255). Defaults to Black (0, 0, 0).
- debugbg: Set to 1 to use Magenta (255, 0, 255) as bgclearcolor for testing, 0 to use your custom value above. Defaults to 0 (can be ommited).
[{Type}BG {Name}]
- type: The type of this BG element. Valid values are: Normal, Anim, Parallax and Dummy. Some options are only available for certain types.
- actionno: Animation Identifier (positive integer value, for Anim type BGs). If used in a Normal type without spriteno, it becomes Anim type automatically.
- spriteno: Sprite Identifier (comma separated positive integer values, Group and Number, for Normal type). If used in a Anim type without actionno, it becomes Normal type automatically.
- layerno: This is the layer number, which determines where the sprite is drawn to. Valid values are 0, 1 and 2. 0 for background (behind characters), 1 for foreground (in front) and 2 for on top of everything. If this line is omitted, the default value of 0 will be assumed.
- start: This is the starting location of the background in the format: X, Y (comma separated float values). If this line is omitted, the default value of 0,0 will be assumed.
- delta: These are the number of pixels the background moves for every single unit of camera movement, in the format: X, Y (comma separated float values). For the main background (eg. the floor the players stand on) you'll want to use a delta of 1,1. Things farther away should have a smaller delta, like 0.5 for example. Things near the camera should have a larget delta. If this line is omitted, the default value of 1,1 will be assumed.
- trans: Here is the transparency setting of the background. Valid values are: None for normal drawing, Add for colour addition (like a spotlight effect), Add1 for colour addition with background dimmed to 50% brightness, AddAlpha for colour addition with control over alpha values (you need an alpha parameter if you use this) and Sub for colour subtraction (like a shadow effect). If this line is omitted, it's assumed that there will be no transparency.
- alpha: Use this parameter only if trans = AddAlpha. First value is the alpha of the source (sprite), and the second is the alpha of the destination (background). The values range from 0 to 256.
- mask: Mask means whether or not to draw colour zero of a sprite (1 to enable, 0 to disable). If you turn masking off, the background will take less CPU power to draw, so remember to turn it off on sprites that don't use it. If this is omitted, it's assumed that there will be no masking.
- tile: The format for tiling is X, Y (comma separated integer values). For each of them, the value is: 0 to use no tiling, 1 to tile, n where (n>1) to tile n times. If this line is omitted, it's assumed that there will be no tiling.
- tilespacing: This is the X and Y space between each tile (comma separated float values), for tiled backgrounds. If omitted, default value is 0,0.
- window: This defines the drawing space, or "window" of the background top clip content into. It's given in the form: Left, Top, Right, Bottom. Make the window smaller if you only want to draw part of the background. You normally do not have to change this setting. Value values range from 0 to LocalCoordX-1 (319 by default) for Left/Right, and 0 to LocalCoordY-1 (239 by default) for Top/Bottom. If ommited, there's no drawing limit (disabled).
- windowdelta: Similar to the delta parameter, this one affects the movement of the window. Defaults to 0,0.
- velocity: Speed the background moves. Format: X, Y (comma separated float values). Defaults to 0,0.
- scalestart: This is the base scale of the BG element. Format: X, Y (comma separated float values). Defaults to 1,1.
- sin.x: Used to create a senoidal movement in the X axis. Format: Amplitude, Period, Offset (comma separated float values). The formula is: Sin((CurrentPeriod + Offset) / Period * PI * 2) * Amplitude.
- sin.y: Used to create a senoidal movement in the Y axis. Format: Amplitude, Period, Offset (comma separated float values). The formula is the same as sin.x.
- positionlink: Set to 1 to "link" this BG to the one above it (the previous, making its positioning to be relative to that BG). This makes velocity and delta to be ignored. 0 to disable this behavior otherwise. Defaults to 0.
- id: Identifier to be used by BG Controllers to change this BG element dynamically under their conditions (integer value).
The parameters bellow are available for use on Stages only, as they rely on Stage space, camera movement and zoom level (options used only during match):
- maskwindow: The same as window, but this is in Stage space, so the origin is ScreenWidth/2 for X and 0 for Y, instead of 0,0 like window. This is the recommended way to clip content as it works alongside zoom options.
- scaledelta: These are the X and Y scales to add to scalestart as the camera moves. Format: X, Y (comma separated float values). Defaults to 0,0 if ommited.
- zoomscale: Scale applied to each unit of zoom other than 1 (float value). Eg.: If zoomscale is 0.5, for Zoom factor = 1, scale is 1. For Zoom factor = 2, scale is 1.5, and so on. This is multiplied by the scale from camera movement (scalestart and scaledelta).
Parallax type BGs are used to create a trapezoidal/perspective effect, where the top is smaller or larger than the bottom, and moves at different speeds as the camera moves.
The options bellow are mutually exclusive, and determine the type of Parallax to be used:
- xscale: This assumes the Bitmap pointed by spriteno is already perspective deformed. Anim type is not allowed with this. Format: ScaleTop, ScaleBottom (comma separated float values).
- width: This defines the top and bottom widths to be transformed by the engine (the Sprite must not be pre-transformed), applying a perspective effect. Format: WidthTop, WidthBottom (comma separated float values).
- paralwidth: The same as width, except the Sprite's axis is ignored, and the new values are X axis = half of Sprite's Bitmap width and Y = 0. Format: WidthTop, WidthBottom (comma separated float values).
Additional vertical scaling options (to create an illusion of distance as the camera moves up or down):
- yscalestart: Starting scale for the Y axis (affecting the height) of the Bitmap, in percentage (float value).
- yscaledelta: Scale to be added to yscalestart based on every single unit of camera movement, in percentage (float value).
[{Type}BGCtrlDef {Name}]
- ctrlid: .
- looptime: .
[{Type}BGCtrl {Name}]
- type: .
- ctrlid: .
- time: .
{Name} can be any name or number to identify this BG (optional, used only for error messsages while parsing).
{Type} is used only for System BGs (ommited otherwise): Title for [Title Info], Select for [Select Info], Versus for [VS Screen], Victory for [Victory Screen] and Option for [Option Info].