API reference
WinLines
pixi-reels / debug / WinLines
Defined in: debug/WinLines.ts:53
Win lines drawn over a reel set with pixi-silk: a payline through one cell per reel, or a payway as every winning cell joined to every winning cell on the next reel.
The library never computes wins (ADR 007); this only draws the cells it is
handed, at their getCellBounds() centres. It lives in the reel set’s own
coordinates, so it pans and scales with the set, and it reads the cells at
draw time: a board that grew since (expand()) is drawn where it is now.
Each call adds one SilkGraphics and returns it, so a line can be faded or
pulsed on its own; clear() removes them all.
import { WinLines } from 'pixi-reels/debug';
const lines = new WinLines(reelSet);
lines.line([{ reelIndex: 0, cellIndex: 1 }, { reelIndex: 1, cellIndex: 0 }, ...]); // a payline
lines.ways(win.perReel); // a payway: [[0, 2], [1], [0, 1, 2]] = cells per reel
reelSet.events.on('spin:start', () => lines.clear());
Extends#
Container
Implements#
Constructors#
Constructor#
new WinLines(_reelSet: ReelSet, options?: WinLinesOptions): WinLines;
Defined in: debug/WinLines.ts:58
Parameters#
| Parameter | Type |
|---|---|
_reelSet | ReelSet |
options | WinLinesOptions |
Returns#
WinLines
Overrides#
Container.constructor
Accessors#
isDestroyed#
Get Signature#
get isDestroyed(): boolean;
Defined in: debug/WinLines.ts:137
Returns
boolean
Implementation of#
Methods#
clear()#
clear(): this;
Defined in: debug/WinLines.ts:131
Remove every line drawn so far. The palette starts over.
Returns#
this
destroy()#
destroy(): void;
Defined in: debug/WinLines.ts:142
Destroy every line with it. Calling it again does nothing.
Returns#
void
Implementation of#
Overrides#
Container.destroy
line()#
line(cells: readonly SymbolPosition[], style?: WinLineStyle): SilkGraphics;
Defined in: debug/WinLines.ts:82
A payline: one polyline through the centres of cells, in the order
given (normally one cell per reel, left to right).
Parameters#
| Parameter | Type |
|---|---|
cells | readonly SymbolPosition[] |
style | WinLineStyle |
Returns#
SilkGraphics
ways()#
ways(perReel: readonly readonly number[][], style?: WinLineStyle & {
fromReel?: number;
}): SilkGraphics;
Defined in: debug/WinLines.ts:105
A payway: perReel[i] holds the winning cell indices on reel
fromReel + i, and every one of them is joined to every one on the next
reel. That lattice is the whole win at once: its paths ARE the ways, so
a 3 x 2 x 3 win draws 6 + 6 segments for its 18 ways, and a win of
millions of ways stays a few dozen segments.
Parameters#
| Parameter | Type |
|---|---|
perReel | readonly readonly number[][] |
style | WinLineStyle & { fromReel?: number; } |
Returns#
SilkGraphics