Function get_front_position

  • Given a direction and a current position, returns the next front position.

    Parameters

    • x_pos: number

      x tile position.

    • y_pos: number

      y tile position.

    • direction: directions

      the direction that's going towards.

    • strict_cardinal: boolean = true

      if true, returns null on diagonal input. Otherwise, returns input as is.

    Returns {
        x: number;
        y: number;
    }

    the front position.

    • x: number
    • y: number