Language Reference Guide : System Classes : SpriteDescriptor Class : ApplySectorMap Method
 
Share this page          
ApplySectorMap Method
The ApplySectorMap method supplies a set of sectors to be used when defining the positions of sprites on the field background.
The sectors are defined by an array of populated SpriteDescriptor objects. Sectors can be any size and any position. Each sector is applied in the array order, so that later sprites may overlap earlier ones.
All attributes of the SpriteDescriptor Class) are relevant to sector definition except opacity and angle (if specified, these are ignored).
Each sector’s position is defined by the descriptor X, Y, XUnit, and YUnit attributes. The descriptor Sector Attribute) must be unique and acts as the sector’s identifier if a unique name is not provided. The descriptor Gravity Attribute) is applied to any sprite positioned relative to this sector.
If the descriptor SpriteSourceIndex is 1, the sector is assumed to be rectangular. If it is >1, the solid (non-transparent) region of the source image with this index defines the shape of the sector.
ApplySectorMap invokes the UpdBackground method on the specified field, applying the descriptors, converted to a string combining the PropertyStrings of the descriptors.
This method has the following syntax:
integer = SpriteDescriptor.ApplySectorMap(targetfield = ActiveField
          [, descriptors = array of SpriteDescriptor])
This method has the following parameters:
targetfield
(Required) Specifies the field to whose background the sprites are applied.
descriptors
Specifies the set of sprite descriptors from which the spritemap is drawn. If none are provided, the host SpriteDescriptor object itself is used.
The method returns ER_OK if the descriptors were applied successfully, or ER_FAIL if the call failed.