Fandom

Pico-8 Wiki

Pset

162pages on
this wiki
Add New Page
Comments0 Share
pset( x, y, [c] )

Sets a pixel in the graphics buffer.

x
The x coordinate.
y
The y coordinate.
c
The color value. If not specified, uses the current color of the draw state.

The pset() function sets a pixel in the graphics buffer.

This operation is affected by the draw state.

Examples Edit

pset(10, 10, 7)                 -- sets (10, 10) to white
print(pget(10, 10), 0, 96, 7)   -- prints 7

pset(10, 10, 8)                 -- sets (10, 10) to red
print(pget(10, 10), 0, 104, 7)  -- prints 8

Repeatedly fill the screen with randomly colored pixels:

function _update()
  -- _update() is required for game loop 
end

function _draw()
  for x=0,127 do
    for y=0,127 do
      pset(x, y, rnd(16))
    end
  end
end

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.