isaacscript-common
Version:
Helper functions and features for IsaacScript mods.
37 lines • 1.76 kB
TypeScript
import type { ButtonAction } from "isaac-typescript-definitions";
import { Direction } from "isaac-typescript-definitions";
/**
* 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.)
*/
export declare function angleToDirection(angleDegrees: int): Direction;
/**
* 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.)
*/
export declare function directionToDegrees(direction: Direction): int;
/**
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
* (0) would return `ButtonAction.LEFT` (0).
*/
export declare function directionToMoveAction(direction: Direction): ButtonAction | undefined;
/**
* Helper function to convert a direction to a shoot `ButtonAction`. For example, `Direction.LEFT`
* (0) would return `ButtonAction.SHOOT_LEFT` (4).
*/
export declare function directionToShootAction(direction: Direction): ButtonAction | undefined;
/**
* Helper function to convert a direction to a `Vector`. For example, `Direction.LEFT` (0) would
* convert to `Vector(-1, 0).
*/
export declare function directionToVector(direction: Direction): Readonly<Vector>;
/**
* Helper function to get the lowercase name of a direction. For example, `Direction.LEFT` (0) would
* return "left".
*/
export declare function getDirectionName(direction: Direction): string | undefined;
//# sourceMappingURL=direction.d.ts.map