oppositeDirection(string direction)
Returns the opposite to any given direction. E.g. south is opposite to north.
local qiso = require "plugin.qisoengine"
qiso.setAssetsFolder("assets")
qiso.loadTiledMap("sample-tilemap")
-- Enable the main Qiso loop to render/update our world
qiso.activate()
-- Get the direction of the tapped tile relative to tile 5,5
function tapTile(event)
-- Get the tile located where the screen was tapped. If there is no tile here, getTile returns nil.
local tile = qiso.getTile(event.x, event.y)
if(tile ~= nil) then
local direction = determineDirection(5, 5, tile.x, tile.y)
print tile.x .. "," .. tile.y .. " is " .. direction .. " of 5,5"
print "5,5 is " .. oppositeDirection(direction) .. " of " .. tile.x .. "," .. tile.y
end
end
-- Do something when the screen is tapped
Runtime:addEventListener('tap', tapTile)