Game Piece
A Game Piece is any counter, marker, or card used in a game.
Game pieces in VASSAL are highly customizable and can have quite
complex behavior. They are defined by adding 'traits' to a basic
piece. A list of available traits appears to the left, and a list
of traits in use by the piece you're defining appears at the
right. Add a trait by selecting it in the list of available
traits
and pushing the 'Add' button. Remove a trait by selecting it and
pushing the 'Remove' button.
As you define your piece, it will appear at the top of the
window. You can select the piece and type commands for it or
right-click to bring up its popup menu to test it as you go.
Once added to your piece, a trait's properties can be edited by
selecting the trait and pushing the 'Properties' button, or by
double-clicking on the trait.
When a piece is drawn, the traits are drawn in order, beginning with
the basic piece and continuing downward. The order of traits can
be important. For example the image in a Layer trait may obscure
the Basic Piece or other Layers beneath it.
For highly specialized pieces, you may supply your own Java classes.
The Java class must implement the GamePiece interface and most
commonly extends the Decorator class. First, add the Java .class
file to the module file using a Zip utility (remember to preserve the
package structure). Then hit the "Import" button and enter the
fully-qualified name of the class. The trait corresponding to
your
class will appear in the list of available traits and you may add it
normally. See the Coding Tutorial for more details.
Piece Traits
A simple piece drawn from an image.
Delete
The ability to be deleted
by players during a game. Specify the name of the corresponding
menu item and the keyboard shortcut.
|
 |
Clone
The ability to be
duplicated by players during a game. Specify the name of the
corresponding menu item and the keyboard shortcut.
|
 |
A sequence of images with key commands to loop through them
Insert a pre-defined set of traits defined in a prototype elsewhere.
A plain text label drawn somewhere on the piece.
The ability to be hidden to non-owning players.
The ability to show only limited information to non-owning players.
Defines a command to automatically send a piece to a pre-defined
location.
Applies a command to to other pieces.
Defines a command to move a piece a fixed distance in a direction
Defines a command to automatically send a piece to a Deck.
Prevents the piece from combining with other pieces in a stack.
Provides a popup window from which players may set and view auxiliary
information about a piece. Includes sophisticated controls for
specifying single- and multi-line text notes and tick-mark boxes for
depletable resources (hit points, shield levels, damage, etc.)
Attaches an editable informational table to a piece. Unlike a
Property Sheet, it contains only plain-text fields, but can contain
arbitrary numbers of rows and columns.
Defines a keyboard command that places another piece on top of this
piece.
Defines a keyboard command that replaces this piece with a different
piece.
Defines ability to rotate through a specified number of facings.
Defines ability to pivot a piece, i.e. rotate around a point other than
the center.
Directs a piece to ignore image transparency for purposes of selecting
a piece with the mouse.
Adds a command that plays a specified sound when invoked.
Allows the piece to be automatically marked when moved in a Map Window.
Draws the recent movement path of the piece as a trail of points.
Highlights a specified radius around a piece.
Creates a sub-menu in the right-click drop-down menu.
Hides or removes keyboard/menu commands when certain conditions apply.
Limit control of a piece from non-owning players.
Allows the piece to automatically report state changes to the chat text
area.
Allows you to trigger keyboard actions with other keyboard actions,
combining multiple keystrokes into a single menu entry.
Allows you to trigger toolbar actions, via the hotkey associated with the button in the toolbar.
Allows you to specify a region of a piece that acts like a button,
invoking an action when a player clicks within the region with the
mouse.
Assigns a fixed value to a named property on a piece.
Assigns a user-changeable value to a named property on a piece.
Defines commands to change the value of a Global Property.
|