YesNoOk
avatar

Animated background elements (Stages) (Read 3413 times)

Started by JustNoPoint, November 02, 2015, 04:30:09 pm
Share this topic:
Animated background elements (Stages)
#1  November 02, 2015, 04:30:09 pm
  • ******
    • www.justnopoint.com/
The format for specifying an animated background element is almost exactly the same as for a normal background element. The differences are described below.

Code:
[BG my_animated_element]
type = anim
actionno = 55
All other parameters other than spriteno are the same as for static background elements.

First, for the element to animate, a type of anim must be specified. Second, an "action number" (actionno) must be specified. This replaces the spriteno parameter that would be used for a normal background element. The value of actionno must be for an animation that is defined in the DEF file. In this example, since actionno is 55, Action 55 must be defined in a manner similar to the following:

Code:
[Begin Action 55]
0,0,0,0,5
0,1,0,0,5
The format is the same as specifying animations in the AIR file, so details will be omitted here. The Action definition can be placed anywhere below the original [BGDef] group. Typical strategies are either to define the action immediately after the element it belongs to, or else to collect all the stage's actions together at the beginning or end of the [BGDef] group.

Note that each sprite you specify in the animation has its own axis (specified in the SFF file). During animation playback, the axis of each sprite will be lined up to correspond with the axis of the background element itself.

The effect of the tilespacing parameter is different for anim-type elements compared to normal-type elements. For a normal element, the x-value of this parameter specifies the horizontal distance between the right edge of the first tile and the left edge of the second tile. In the case of an anim element, the x-value specifies the horizontal distance between the left edge of the first tile and the left edge of the second tile. This applies similarly for the y-value. The reason for the difference is because the size of an anim is not necessarily constant. tilespacing is required for anim-type elements that use the tile parameter.

Animated elements always have mask = 1 and cannot be set to non-masked.