Skip to content

Instantly share code, notes, and snippets.

@ericthomasca
Created January 23, 2025 23:34
Show Gist options
  • Save ericthomasca/35047035955fd050c94ec142880c08ba to your computer and use it in GitHub Desktop.
Save ericthomasca/35047035955fd050c94ec142880c08ba to your computer and use it in GitHub Desktop.
PICO-8 Collision Function
--collision function
function collide(player)
local x1=player.x/8
local y1=player.y/8
local x2=(player.x+7)/8
local y2=(player.y+7)/8
local a=fget(mget(x1,y1),0)
local b=fget(mget(x1,y2),0)
local c=fget(mget(x2,y2),0)
local d=fget(mget(x2,y1),0)
if a or b or c or d then
return true
else
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment