Skip to content

Profectus / game/boards/board / placeInAvailableSpace

Function: placeInAvailableSpace() ​

placeInAvailableSpace<T>(nodeToPlace, nodes, radius, direction): void

Moves a node so that it is sufficiently far away from any other nodes, to prevent overlapping.

Type Parameters ​

• T extends NodePosition

Parameters ​

nodeToPlace ​

T

The node to find a spot for, with it's current/preffered position.

nodes ​

T[]

The list of nodes to make sure nodeToPlace is far enough away from.

radius ​

number = 100

How far away nodeToPlace must be from any other nodes.

direction ​

Direction = Direction.Right

The direction to push the nodeToPlace until it finds an available spot.

Returns ​

void

Defined in ​

profectus/src/game/boards/board.tsx:406