Created
August 15, 2013 18:22
-
-
Save dyerrington/6243322 to your computer and use it in GitHub Desktop.
Detect obstacles based on layer properties.
This file contains 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
--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