Skip to main content

Direction

Functions

angleToDirection

angleToDirection(angleDegrees): Direction

Helper function to convert the degrees of an angle to the Direction enum.

Note that this function considers 0 degrees to be pointing to the right, which is unusual because 0 normally corresponds to up. (This corresponds to how the Vector.GetAngleDegrees method works.)

Parameters

NameType
angleDegreesint

Returns

Direction

Defined in

packages/isaacscript-common/src/functions/direction.ts:16


directionToDegrees

directionToDegrees(direction): int

Helper function to convert a direction to degrees. For example, Direction.LEFT (0) would return 180 and Direction.RIGHT (2) would return 0. (This corresponds to how the Vector.GetAngleDegrees method works.)

Parameters

NameType
directionDirection

Returns

int

Defined in

packages/isaacscript-common/src/functions/direction.ts:47


directionToMoveAction

directionToMoveAction(direction): ButtonAction | undefined

Helper function to convert a direction to a shoot ButtonAction. For example, Direction.LEFT (0) would return ButtonAction.LEFT (0).

Parameters

NameType
directionDirection

Returns

ButtonAction | undefined

Defined in

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


directionToShootAction

directionToShootAction(direction): ButtonAction | undefined

Helper function to convert a direction to a shoot ButtonAction. For example, Direction.LEFT (0) would return ButtonAction.SHOOT_LEFT (4).

Parameters

NameType
directionDirection

Returns

ButtonAction | undefined

Defined in

packages/isaacscript-common/src/functions/direction.ts:65


directionToVector

directionToVector(direction): Readonly<Vector>

Helper function to convert a direction to a Vector. For example, Direction.LEFT (0) would convert to `Vector(-1, 0).

Parameters

NameType
directionDirection

Returns

Readonly<Vector>

Defined in

packages/isaacscript-common/src/functions/direction.ts:75


getDirectionName

getDirectionName(direction): string | undefined

Helper function to get the lowercase name of a direction. For example, Direction.LEFT (0) would return "left".

Parameters

NameType
directionDirection

Returns

string | undefined

Defined in

packages/isaacscript-common/src/functions/direction.ts:83