Fandom

Pico-8 Wiki

Camera

162pages on
this wiki
Add New Page
Comments0 Share
camera( x, y )

Sets the camera offset in the draw state.

x
The x offset, in pixels.
y
The y offset, in pixels.

Setting a camera offset causes all subsequent draw operations to have their x and y coordinates augmented by the specified amount.

Calling camera() with no arguments resets the camera offset to (0, 0).

Offset values are subtracted from the draw coordinates. If you want the draw operation to occur to the left or below the original coordinates, use a negative offset value.

Camera offsets can be used to implement screen effects such as parallax scrolling (with a different offset per layer) or screen shake (a small random offset per frame).

Examples Edit

-- draw a dark blue circle at (20, 20)
circfill(20, 20, 10, 1)

camera(-2, 2)

-- draw a white circle at (22, 18)
circfill(20, 20, 10, 7)

See also Edit

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.