Skip to content

1681-engine / pixel / NightShade

Class: NightShade ​

Defined in: src/pixel/NightShade.ts:26

The outdoor night: a DayClock's grade laid over the world as a dithered Darkness, deepening at dusk and lifting at dawn, with every lamp, window and fire burning a hole in it — the same erase trick an underground is lit by, only with a sheet whose colour and depth follow the clock. A place under no sky (a cave) builds a Darkness of its own instead; at noon the sheet has no alpha and costs nothing.

Constructors ​

Constructor ​

ts
new NightShade(stage, options): NightShade;

Defined in: src/pixel/NightShade.ts:32

Parameters ​

ParameterType
stageStage
optionsNightShadeOptions

Returns ​

NightShade

Methods ​

addLight() ​

ts
addLight(
   x, 
   y, 
   glowSize, 
   color?, 
   flicker?
): void;

Defined in: src/pixel/NightShade.ts:44

A light the place glows with, glowSize the diameter of the glow drawn for it: by night it is what is seen by.

Parameters ​

ParameterTypeDefault value
xnumberundefined
ynumberundefined
glowSizenumberundefined
color?numberundefined
flicker?number0

Returns ​

void


destroy() ​

ts
destroy(): void;

Defined in: src/pixel/NightShade.ts:61

Returns ​

void


setLampsDimmed() ​

ts
setLampsDimmed(dim): void;

Defined in: src/pixel/NightShade.ts:49

Lamps colour the dark less (a "fewer ambient lights" setting); their holes stay as wide.

Parameters ​

ParameterType
dimboolean

Returns ​

void


update() ​

ts
update(
   now, 
   wallMs, 
   px, 
   py
): void;

Defined in: src/pixel/NightShade.ts:54

now the frame's ms, wallMs the shared wall time the clock reads (serverNow()), px/py the player.

Parameters ​

ParameterType
nownumber
wallMsnumber
pxnumber
pynumber

Returns ​

void

Released under the MIT License.