Skip to main content

Position Velocity

Functions

anyEntityCloserThan

anyEntityCloserThan(entities, position, distance): boolean

Parameters

NameType
entitiesreadonly Entity[]
positionVector
distanceint

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/positionVelocity.ts:14


anyPlayerCloserThan

anyPlayerCloserThan(position, distance): boolean

Iterates over all players and checks if any player is close enough to the specified position.

Note that this function does not consider players with a non-undefined parent, since they are not real players (e.g. the Strawman Keeper).

Parameters

NameType
positionVector
distancefloat

Returns

boolean

Defined in

packages/isaacscript-common/src/functions/positionVelocity.ts:30


findFreePosition

findFreePosition(startingPosition, avoidActiveEntities?, minimumDistance?): Readonly<Vector>

Helper function to get a room position that is not overlapping with a grid entity, a heaven door, or a player. The Room.FindFreePickupSpawnPosition method will return locations that overlap with heaven doors and partially overlap with players, if the thing being spawned is bigger than a tile (like a Blood Donation Machine). Use this function instead if you want to account for those specific situations.

Parameters

NameTypeDefault valueDescription
startingPositionVectorundefinedThe position to start searching from. If this position is not overlapping with anything, then it will be returned.
avoidActiveEntitiesbooleanfalseOptional. Default is false.
minimumDistance?floatundefinedOptional. If specified, will ensure that the randomly generated position is equal to or greater than the distance provided.

Returns

Readonly<Vector>

Defined in

packages/isaacscript-common/src/functions/positionVelocity.ts:53


getEntityPositions

getEntityPositions(entities?): ReadonlyMap<PtrHash, Vector>

Helper function to get a map containing the positions of every entity in the current room.

This is useful for rewinding entity positions at a later time. Also see setEntityPositions.

Parameters

NameTypeDescription
entities?readonly Entity[]Optional. If provided, will only get the positions of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

Returns

ReadonlyMap<PtrHash, Vector>

Defined in

packages/isaacscript-common/src/functions/positionVelocity.ts:112


getEntityVelocities

getEntityVelocities(entities?): ReadonlyMap<PtrHash, Vector>

Helper function to get a map containing the velocities of every entity in the current room.

This is useful for rewinding entity velocities at a later time. Also see setEntityVelocities.

Parameters

NameTypeDescription
entities?readonly Entity[]Optional. If provided, will only get the velocities of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

Returns

ReadonlyMap<PtrHash, Vector>

Defined in

packages/isaacscript-common/src/functions/positionVelocity.ts:137


setEntityPositions

setEntityPositions(entityPositions, entities?): void

Helper function to set the position of every entity in the room based on a map of positions. If an entity is found that does not have matching element in the provided map, then that entity will be skipped.

This function is useful for rewinding entity positions at a later time. Also see getEntityPositions.

Parameters

NameTypeDescription
entityPositionsReadonlyMap<PtrHash, Vector>The map providing the positions for every entity.
entities?readonly Entity[]Optional. If provided, will only set the positions of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

Returns

void

Defined in

packages/isaacscript-common/src/functions/positionVelocity.ts:166


setEntityVelocities

setEntityVelocities(entityVelocities, entities?): void

Helper function to set the velocity of every entity in the room based on a map of velocities. If an entity is found that does not have matching element in the provided map, then that entity will be skipped.

This function is useful for rewinding entity velocities at a later time. Also see getEntityVelocities.

Parameters

NameTypeDescription
entityVelocitiesReadonlyMap<PtrHash, Vector>The map providing the velocities for every entity.
entities?readonly Entity[]Optional. If provided, will only set the velocities of the provided entities. Use this with cached entities to avoid invoking the Isaac.GetRoomEntities method multiple times.

Returns

void

Defined in

packages/isaacscript-common/src/functions/positionVelocity.ts:196