Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

DamageDisplay

Globals

LAT_AFTERIMAGE

integer

LAT_COUNT

integer

LAT_LINEAR_DISPLAY

integer

LAT_MOVE

integer

LAT_NONE

integer

LAT_SHAKE

integer

PCT_DEFAULT

integer

PCT_SHIP_COLLISION

integer

Aliases

LINEAR_ANIMATION_TYPE

LAT_AFTERIMAGE|LAT_COUNT|LAT_LINEAR_DISPLAY|LAT_MOVE|LAT_NONE…(+1)

-- objects/DamageDisplay
LINEAR_ANIMATION_TYPE:
    | `LAT_AFTERIMAGE`
    | `LAT_COUNT`
    | `LAT_LINEAR_DISPLAY`
    | `LAT_MOVE`
    | `LAT_NONE`
    | `LAT_SHAKE`

POSITION_CALCULATION_TYPE

PCT_DEFAULT|PCT_SHIP_COLLISION

-- objects/DamageDisplay
POSITION_CALCULATION_TYPE:
    | `PCT_DEFAULT`
    | `PCT_SHIP_COLLISION`

Classes

Class: DamageDisplay

Extends Widget

DamageDisplay

A DamageDisplay widget displays animated damage or combat-related text. Supports configurable animation sequences, positional calculation modes, and dynamic placement relative to source and target units. Provides control over insets, initial positioning, and animation behavior, enabling effects such as movement, shaking, scaling, fading, and afterimages commonly used in combat feedback and hit indicators.

Dependencies:

  • TextStyle used for the style and extraStyle fields.

Field: style

TextStyle

The text style applied to the widget’s text.

Field: extraStyle

TextStyle

TextStyle

A TextStyle defines the visual appearance of text within a widget, including font, size, color, alignment, outline, shadow, ellipsis, and snapping behavior. It can measure text width and line height, and supports special font types for image-based text rendering.

Method: SetInset

(method) DamageDisplay:SetInset(left: number, top: number, right: number, bottom: number)

Sets the inset of the DamageDisplay.

@param left — The left inset. (default: 0)

@param top — The top inset. (default: 0)

@param right — The right inset. (default: 0)

@param bottom — The bottom inset. (default: 0)

Method: SetUnitId

(method) DamageDisplay:SetUnitId(sourceId: string, targetId: string)

Sets the source and target unit IDs for the DamageDisplay.

@param sourceId — The source unit ID.

@param targetId — The target unit ID.

Method: SetPositionCalculationType

(method) DamageDisplay:SetPositionCalculationType(positionCalculationType: `PCT_DEFAULT`|`PCT_SHIP_COLLISION`)

Sets the position calculation type for the DamageDisplay.

@param positionCalculationType — The position calculation type. (default: PCT_DEFAULT)

-- objects/DamageDisplay
positionCalculationType:
    | `PCT_DEFAULT`
    | `PCT_SHIP_COLLISION`

Method: SetInitPos

(method) DamageDisplay:SetInitPos(x: number, y: number)

Sets the initial position of the DamageDisplay.

@param x — The x-coordinate of the initial position. (default: 0)

@param y — The y-coordinate of the initial position. (default: 0)

Method: GetInset

(method) DamageDisplay:GetInset()
  -> left: number
  2. top: number
  3. right: number
  4. bottom: number

Retrieves the inset of the DamageDisplay.

@return left — The left inset. (default: 0)

@return top — The top inset. (default: 0)

@return right — The right inset. (default: 0)

@return bottom — The bottom inset. (default: 0)

Method: SetAnimFrameInfo

(method) DamageDisplay:SetAnimFrameInfo(frameInfo: FrameInfo[])

Sets the animation frame information for the DamageDisplay.

@param frameInfo — An array of frame information for the animation.

See: FrameInfo

Method: GetActualDrawn

(method) DamageDisplay:GetActualDrawn()
  -> x1: number
  2. y1: number
  3. x2: number
  4. y2: number

Retrieves the actual drawn coordinates of the DamageDisplay text when animating.

@return x1 — The left coordinate. (default: 0)

@return y1 — The top coordinate. (default: 0)

@return x2 — The right coordinate. (default: 0)

@return y2 — The bottom coordinate. (default: 0)

Method: Animation

(method) DamageDisplay:Animation(anim: boolean)

Enables or disables animation for the DamageDisplay.

@param animtrue to enable animation, false to disable. (default: false)