Skip to content

1681-engine / index / pickInView

Function: pickInView() ​

ts
function pickInView<T>(
   items, 
   view, 
   random, 
   tries?
): T | null;

Defined in: src/ambient/life/lifeMotion.ts:41

One of items in view, tried tries times at random rather than filtered: a forest's thousands of tiles cost the same few reads as a hamlet's dozen, and a miss only means the body waits a frame to try again.

Type Parameters ​

Type Parameter
T extends LifeBox

Parameters ​

ParameterTypeDefault value
itemsreadonly T[]undefined
viewViewRectundefined
random() => numberundefined
triesnumber8

Returns ​

T | null

Released under the MIT License.