A Layer is the basic method for adding functionality to game pieces in VASSAL. A Layer consists of a number of 'levels,' each of which has an image and a name. The Layer can be activated with a keyboard command, and players can change the current level during play. The image from the current level will be drawn whenever the Layer is activated. The Layer is drawn on top the traits that appear before it in the list of traits
'Name:' The name of this Layer, used for reference during editing and as the prefix for the name of any Properties defined by this Layer.
''''Always Active: If checked, then this layer is always active. I.e., the current layer will always be displayed. If unchecked, then the layer must be activated (by the specified keyboard command) in order to display the current layer.
Underneath when highlighted:' If checked, then this layer will be drawn underneath the rest of the piece when the counter has been highlighted (by clicking on it).
Loop through levels: If checked, then increasing the level past the last one will loop through to the first level and vice versa. Otherwise, increasing the level has no effect if the current level is the last level.
Offset: The images of a level are drawn with their center offset from the center of the underlying piece by a number of pixels specified by the "offset" boxes, with positive numbers giving an offset down and to the right. For example, if a layer image is 40x40 pixels and you want it to be drawn so that the lower-left corner is at the center of the GamePiece, set the offset to 20,-20.
Levels follow Property Value: If selected, then you can specify the name of a Property that will determine the active level, rather than responding directly to keyboard events. A typical use will use the name of a Dynamic Property. You can also specify the numeric value of the property that should correspond to the first level of this Layer.
Activate/Increase/Decrease: Specify the keyboard commands and right-click menu text that will activate the Layer and increase or decrease the current level. The Activate keyboard shortcut can specify a string of characters, such that the layer is activated only when all the corresponding keys have been pressed. The Increase/Decrease keyboard shortcuts can also specify a string of characters, such that the level is increased/decreased when any one of the keys is pressed.
Reset to level: Specifies a keyboard command that resets the Layer to a specified level. This does not automatically activate the Layer.
Randomize: Specifies a keyboard command that sets the Layer to a random level.
Level Images: Specify the image to be shown for each layer by double-clicking or selecting from the drop-down menu. An image can be left blank to display nothing for that level. Using transparency in the images can be very useful.
Level Name: Each level can be given an individual name, which is used to change the name of the piece for reporting purposes during play. The level's name either replaces the piece's normal name, or else modifies the piece's normal name as a prefix or suffix.
- Leaving the menu-command field blank means no entry appears in the right-click menu, but you can still use a keyboard shortcut.
- Keyboard shortcuts can be the same as those used by other traits. Typing the key will perform all corresponding actions.
- 'For a basic two-sided counter, add a Layer, and select an image that represents the reverse side. Change "Activate" to "Flip" and set the key to "F". '
- 'To represent fatigue in an Army counter, give it a Layer named "Fatigue." Select "Always Active", choose four images that represent the levels, and change "Increase" to "Increase Fatigue" and "Decrease" to "Decrease Fatigue". A Reset command named "Rest" using CTRL-R could be used to bring the Army counter back to full strength. Name the levels " (fatigue 1)", etc., and check "is suffix" to append the current fatigue level to the piece's name.
A Layer defines a number of Properties. In the name of the properties, <layer_name> is the name of the overall Layer as specified in the top field of the properties.
- <layer_name>_Image returns the name of the currently-active level's image file'''
- <layer_name>_Name returns the name of the currently-active levelMap
- <layer_name>_Level returns the number of the current levelMap
- <layer_name>_Active returns true if the Layer is active, false otherwise
EXAMPLE: A Layer named Manpower that is active and showing level 4 defined with image Man04.gif and name (strength 4) would have the following properties:
- Manpower_Image = Man04.gif
- Manpower_Name = (strength 4)
- Manpower_Level = 4
- Manpower_Active = true
These properties could be used in a Global Key Command to automatically remove all counters whose manpower was zero.