1681-engine / pixel / Darkness
Class: Darkness ​
Defined in: src/pixel/Darkness.ts:116
Constructors ​
Constructor ​
new Darkness(
stage,
color,
alpha,
options?
): Darkness;Defined in: src/pixel/Darkness.ts:159
Parameters ​
| Parameter | Type |
|---|---|
stage | Stage |
color | number |
alpha | number |
options | DarknessOptions |
Returns ​
Darkness
Properties ​
carriedLight ​
readonly carriedLight: number;Defined in: src/pixel/Darkness.ts:157
The radius update uses when it is given none (DarknessOptions.carriedLight).
Methods ​
addLamp() ​
addLamp(
x,
y,
radius,
flicker?,
color?
): void;Defined in: src/pixel/Darkness.ts:192
A lamp fixed in the world: a torch on a wall, the seep in its chamber, a crystal in a seam, in its own colour.
Parameters ​
| Parameter | Type | Default value |
|---|---|---|
x | number | undefined |
y | number | undefined |
radius | number | undefined |
flicker | number | 0 |
color | number | WARM_LIGHT |
Returns ​
void
destroy() ​
destroy(): void;Defined in: src/pixel/Darkness.ts:330
Returns ​
void
setLampsDimmed() ​
setLampsDimmed(dim): void;Defined in: src/pixel/Darkness.ts:212
Dimmed lamps lay only LAMP_DIM of their colour on the dark (a "fewer ambient lights" setting). The holes they cut stay as wide, so a dark place is still seen by them.
Parameters ​
| Parameter | Type |
|---|---|
dim | boolean |
Returns ​
void
setShade() ​
setShade(color, alpha): void;Defined in: src/pixel/Darkness.ts:202
Changes how dark and what colour the sheet is (the outdoor night, NightShade, deepens and lifts with the world clock). A sheet with no alpha left is neither drawn nor redrawn, so a map at noon pays nothing for its night.
Parameters ​
| Parameter | Type |
|---|---|
color | number |
alpha | number |
Returns ​
void
update() ​
update(
now,
px,
py,
carriedRadius?
): void;Defined in: src/pixel/Darkness.ts:240
Redraws the night with this frame's holes in it, when anything in it changed. px/py is where the player stands; carriedRadius is the light they carry (default the carriedLight option, 0 for none).
Parameters ​
| Parameter | Type |
|---|---|
now | number |
px | number |
py | number |
carriedRadius | number |
Returns ​
void