Skip to content

Direction

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

int

Direction


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

Direction

int


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

Direction

ButtonAction | undefined


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

Direction

ButtonAction | undefined


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

Direction

Readonly<Vector>


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

Direction

string | undefined