Create account / Log in
Page Discussion History

ActionButton

From VASSAL

Jump to: navigation, search

VASSAL Reference Manual

Home > Module > Game Piece Palette >' Game Piece > Action Button'


Action Button

This trait allows you to place a virtual button within your piece.   Clicking within the specified rectangular region on the piece will invoke an action just as if the corresponding key command had been typed.

Invoke Key Command: The keyboard command to be invoked.
Button X-offset: The horizontal position of the upper-left corner of the rectangle, in pixels from the center of the piece.   Negative numbers are toward the left.
Button Y-offset: The vertical position of the upper-left corner of the rectangle, in pixels from the center of the piece.   Negative numbers are toward the top.
''''Button Width: The width in pixels of the button.
''''''''''
Button Height: The height in pixels of the button.

This trait does not alter the way a piece is drawn, so the Basic Piece or a Layer should supply a visual cue to the player that the button exists.

To make a button that can be activated and deactivated, combine an Action Button with a Layer and a Trigger Action.  

Example
:   A piece representing a spaceship has a self-destruct action that can only be activated when the energy reaches the minimum level.   A Layer named Energy is used to represent the energy.   The image for the lowest level of the layer adds an icon for a self-destruct button.   An Action Button trait uses the boundaries of the button icon and invokes CTRL-ALT-T.   A Trigger Action watches for CTRL-ALT-T and invokes the keyboard command for self-destruct when the properties match Energy_Level = 1.

ActionButton.png