Skip to content

Instantly share code, notes, and snippets.

@Achie72
Last active October 12, 2022 18:19
Show Gist options
  • Select an option

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

Select an option

Save Achie72/0ebe3b4db4d0fa8cb78fa9db83f478a1 to your computer and use it in GitHub Desktop.
TIC-80 Dodge Glitch effect
-- made for my Devtober2022 entry
-- you can read the corresponding devlog on:
-- https://ko-fi.com/post/Eng-Devtober2022-4--We-got-to-have-glitch-effe-S6S1FM1IC
-- https://itch.io/jam/devtober-2022/topic/2406837/achies-devlog-shmup-game
if dodgeTimer > 0 then
-- do it for each y level
for i=0,7 do
if math.random() > 0.5 then
local startLine = math.random(-10,0)
local endLine = math.random(0,10)
for j=startLine,endLine do
-- calculate the pixel index
local decPos = math.floor(x+4)+j+((math.floor(y)+i)*240)
-- turn it to hexa
local hexPos = ('%X'):format(decPos)
-- poke
poke4(0x0000+tonumber(hexPos,16),11)
end
end
end
else
-- draw exhaust
draw_outline(4+idx,x+leaning,y+8,0,8)
-- draw ship
draw_outline(2+leaning,x,y,0,8)
if hasShield then
--draw shield
local size = 8*(shield/maxShield)
ellib(x+3,y+4,size,size,11)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment