Direction
Functions
Section titled “Functions”angleToDirection()
Section titled “angleToDirection()”angleToDirection(
angleDegrees):Direction
Defined in: packages/isaacscript-common/src/functions/direction.ts:16
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
Section titled “Parameters”angleDegrees
Section titled “angleDegrees”int
Returns
Section titled “Returns”Direction
directionToDegrees()
Section titled “directionToDegrees()”directionToDegrees(
direction):int
Defined in: packages/isaacscript-common/src/functions/direction.ts:47
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
Section titled “Parameters”direction
Section titled “direction”Direction
Returns
Section titled “Returns”int
directionToMoveAction()
Section titled “directionToMoveAction()”directionToMoveAction(
direction):ButtonAction|undefined
Defined in: packages/isaacscript-common/src/functions/direction.ts:55
Helper function to convert a direction to a shoot ButtonAction. For example, Direction.LEFT
(0) would return ButtonAction.LEFT (0).
Parameters
Section titled “Parameters”direction
Section titled “direction”Direction
Returns
Section titled “Returns”ButtonAction | undefined
directionToShootAction()
Section titled “directionToShootAction()”directionToShootAction(
direction):ButtonAction|undefined
Defined in: packages/isaacscript-common/src/functions/direction.ts:65
Helper function to convert a direction to a shoot ButtonAction. For example, Direction.LEFT
(0) would return ButtonAction.SHOOT_LEFT (4).
Parameters
Section titled “Parameters”direction
Section titled “direction”Direction
Returns
Section titled “Returns”ButtonAction | undefined
directionToVector()
Section titled “directionToVector()”directionToVector(
direction):Readonly<Vector>
Defined in: packages/isaacscript-common/src/functions/direction.ts:75
Helper function to convert a direction to a Vector. For example, Direction.LEFT (0) would
convert to `Vector(-1, 0).
Parameters
Section titled “Parameters”direction
Section titled “direction”Direction
Returns
Section titled “Returns”Readonly<Vector>
getDirectionName()
Section titled “getDirectionName()”getDirectionName(
direction):string|undefined
Defined in: packages/isaacscript-common/src/functions/direction.ts:83
Helper function to get the lowercase name of a direction. For example, Direction.LEFT (0) would
return “left”.
Parameters
Section titled “Parameters”direction
Section titled “direction”Direction
Returns
Section titled “Returns”string | undefined
