Skip to main content

createCooldownIcon

@zylem/game-lib


@zylem/game-lib / entity / createCooldownIcon

Function: createCooldownIcon()

createCooldownIcon(...args): ZylemCooldownIcon

Defined in: packages/game-lib/src/lib/entities/cooldown-icon.ts:496

Create a WoW-style cooldown icon UI entity.

Parameters​

args​

...CooldownIconOptions[]

Returns​

ZylemCooldownIcon

Example​

const attackIcon = createCooldownIcon({
cooldown: 'attack',
icon: swordIconPath,
screenAnchor: 'top-center', // reference point on the viewport
screenPosition: { x: 0, y: 10 }, // offset in view units from anchor
iconSize: 'sm', // preset (16 × 16 view units)
// iconSize: 24, // square (24 × 24 view units)
// iconSize: { width: 16, height: 24 }, // custom rectangle
});