Created
January 23, 2025 23:34
-
-
Save ericthomasca/35047035955fd050c94ec142880c08ba to your computer and use it in GitHub Desktop.
PICO-8 Collision Function
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--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