Skip to content

Instantly share code, notes, and snippets.

@morningtoast
Created January 5, 2017 01:31
Show Gist options
  • Select an option

  • Save morningtoast/18a2f24a0706226e8762116b801303c4 to your computer and use it in GitHub Desktop.

Select an option

Save morningtoast/18a2f24a0706226e8762116b801303c4 to your computer and use it in GitHub Desktop.
Glitch effect for Pico-8
function glitchfx(lines)
local lines=lines or 64
for i=1,lines do
row=flr(rnd(128))
row2=flr(rnd(127))
if (row2>=row) row2+=1
// copy a row from the
// screen into temp memory
memcpy(0x4300, 0x6000+64*row, 64)
//copy another row from the
// screen to our original row
memcpy(0x6000+64*row, 0x6000+64*row2, 64)
//copy the temp row into row2's
//original slot
memcpy(0x6000+64*row2, 0x4300,64)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment