Function getDirection

  • Return a 0 to 3 value indicating the four main directions (horizontal, upward diagonal, vertical, downward diagonal).

    Parameters

    • x: number

      The x coordinate.

    • y: number

      The y coordinate.

    Returns number

    The direction as a 0 to 4 value.