Skip to content

Instantly share code, notes, and snippets.

@Achie72
Last active October 10, 2022 20:52
Show Gist options
  • Select an option

  • Save Achie72/e43cd245b702f8240dfd9b76d1ea1056 to your computer and use it in GitHub Desktop.

Select an option

Save Achie72/e43cd245b702f8240dfd9b76d1ea1056 to your computer and use it in GitHub Desktop.
TIC-80 outline
-- made for my Devtober2022 entry
-- you can read the corresponding devlog on:
-- https://ko-fi.com/post/Eng-Devtober2020-2--Graphical-Enhancements-X8X3FKCIB
-- https://itch.io/jam/devtober-2022/topic/2406837/achies-devlog-shmup-game
function draw_outline(_spr,_x,_y,_bg,_clr)
--palette address in memory
local palette_map = 0x3ff0
-- loop through colors and set all of them to the outline color.
for c=1,15 do
poke4(palette_map*2+c,_clr)
end
-- draw the sprite 4 times offset to the left-right up-down
for i=_x-1,_x+1,1 do
for j=_y-1,_y+1,1 do
spr(_spr,i,j,_bg)
end
end
-- reset the palette
for c=0,15 do
poke4(palette_map*2+c,c)
end
-- draw the original sprite
spr(_spr,_x,_y,_bg)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment