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
Name | Type |
---|---|
angleDegrees | int |
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
Name | Type |
---|---|
direction | Direction |
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
Name | Type |
---|---|
direction | Direction |
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
Name | Type |
---|---|
direction | Direction |
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
Name | Type |
---|---|
direction | Direction |
Returns
Readonly
<Vector
>