Skip to main content

Room Grid

These functions have to do with the grid index inside of a room (i.e. the grid index that grid entities use).

For functions having to do with the room grid index of the level, see the "Level Grid" functions.

Functions

gridCoordinatesToWorldPosition

gridCoordinatesToWorldPosition(x, y): Readonly<Vector>

Helper function to convert grid coordinates to a world position Vector.

For example, the coordinates of (0, 0) are equal to Vector(80, 160).

Parameters

NameType
xint
yint

Returns

Readonly<Vector>

Defined in

packages/isaacscript-common/src/functions/roomGrid.ts:25


gridIndexToGridPosition

gridIndexToGridPosition(gridIndex, roomShape): Readonly<Vector>

Helper function to convert a grid index to a grid position.

For example, in a 1x1 room, grid index 0 is equal to "Vector(-1, -1) and grid index 16 is equal to "Vector(0, 0)".

Parameters

NameType
gridIndexint
roomShapeRoomShape

Returns

Readonly<Vector>

Defined in

packages/isaacscript-common/src/functions/roomGrid.ts:39


gridPositionToWorldPosition

gridPositionToWorldPosition(gridPosition): Readonly<Vector>

Helper function to convert a grid position Vector to a world position Vector.

For example, the coordinates of (0, 0) are equal to Vector(80, 160).

Parameters

NameType
gridPositionVector

Returns

Readonly<Vector>

Defined in

packages/isaacscript-common/src/functions/roomGrid.ts:55


isValidGridPosition

isValidGridPosition(gridPosition, roomShape): boolean

Test if a grid position is actually in the given RoomShape.

In this context, the grid position of the top-left wall is "Vector(-1, -1)".

Parameters

NameType
gridPositionVector
roomShapeRoomShape

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/roomGrid.ts:69


worldPositionToGridPosition

worldPositionToGridPosition(worldPos): Readonly<Vector>

Helper function to convert a world position Vector to a grid position Vector.

In this context, the grid position of the top-left wall is "Vector(-1, -1)".

Parameters

NameType
worldPosVector

Returns

Readonly<Vector>

Defined in

packages/isaacscript-common/src/functions/roomGrid.ts:107


worldPositionToGridPositionFast

worldPositionToGridPositionFast(worldPos): Readonly<Vector>

Helper function to convert a world position Vector to a grid position Vector.

In this context, the grid position of the top-left wall is "Vector(-1, -1)".

This is similar to the worldPositionToGridPosition function, but the values are not rounded.

Parameters

NameType
worldPosVector

Returns

Readonly<Vector>

Defined in

packages/isaacscript-common/src/functions/roomGrid.ts:122