Skip to 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.

gridCoordinatesToWorldPosition(x, y): Readonly<Vector>

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

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

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

int

int

Readonly<Vector>


gridIndexToGridPosition(gridIndex, roomShape): Readonly<Vector>

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

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)”.

int

RoomShape

Readonly<Vector>


gridPositionToWorldPosition(gridPosition): Readonly<Vector>

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

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).

Vector

Readonly<Vector>


isValidGridPosition(gridPosition, roomShape): boolean

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

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)”.

Vector

RoomShape

boolean


worldPositionToGridPosition(worldPos): Readonly<Vector>

Defined in: packages/isaacscript-common/src/functions/roomGrid.ts:83

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)”.

Vector

Readonly<Vector>


worldPositionToGridPositionFast(worldPos): Readonly<Vector>

Defined in: packages/isaacscript-common/src/functions/roomGrid.ts:98

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.

Vector

Readonly<Vector>