Skip to content

Instantly share code, notes, and snippets.

@dyerrington
Created August 15, 2013 18:22
Show Gist options
  • Save dyerrington/6243322 to your computer and use it in GitHub Desktop.
Save dyerrington/6243322 to your computer and use it in GitHub Desktop.
Detect obstacles based on layer properties.
--DETECT OBSTACLES ------------------------------------------------------------
local obstacle = function(level, locX, locY)
local detect = mte.getTileProperties({level = level, locX = locX, locY = locY})
for i = 1, #detect, 1 do
-- I forget why I check the tile property...
if detect[i].tile then
-- does its layers property solid?
if layers[i].properties and layers[i].properties.solid and detect[i].tile > 0 then
detect = "stop"
player:pause()
return detect
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment