Skip to content

Instantly share code, notes, and snippets.

View james-york's full-sized avatar
🌴
On vacation

James York james-york

🌴
On vacation
View GitHub Profile
-- In RGB displays, each pixel contains 3 subpixels for red, green and blue.
-- The intensity of each subpixel can be changed independently.
-- Mixing different intensities of each allows for a large range of colors.
-- In this program, we'll use a similar approach.
-- Except our RGB subpixels can only be on or off, which limits us to 8 colors.
-- We can treat a PICO-8 color index like an RGB pixel by treating the first 3
-- bits as flags for each RGB subpixel.
@Liquidream
Liquidream / outline_sprite.p8.lua
Last active October 23, 2021 16:20
Useful sprite draw function for PICO-8 (and maybe Lua in general)
--
-- draws a sprite to the screen with an outline of the specified colour
--
function outline_sprite(n,col_outline,x,y,w,h,flip_x,flip_y)
-- reset palette to black
for c=1,15 do
pal(c,col_outline)
end
-- draw outline
for xx=-1,1 do