Skip to main content

Rotate Coordinates (screen.rotate_xy)

Declaration​

rx, ry = screen.rotate_xy(x, y, rotation)

Parameters​

  • x, y
    Integer. Coordinates to rotate.
  • rotation
    0 = no rotation
    1 = rotate left 90°
    2 = rotate right 90°
    3 = rotate 180°

Returns​

  • rx, ry
    Integer. Coordinates after applying the specified rotation.

Description​

Rotate coordinates, typically used to convert portrait coordinates to landscape: init(0) -> init(rotation).

Example​

rx, ry = screen.rotate_xy(100, 200, 1)