{script} getDistance
Posted: Sun Sep 30, 2012 3:41 pm
Hi all.
This script returns the direct number of squares between obj1 and obj2.
enjoy 
This script returns the direct number of squares between obj1 and obj2.
Code: Select all
function getDistance(obj1,obj2)
local distance = 0
local XNumber = math.max(obj1.x,obj2.x) - math.min(obj1.x,obj2.x)
local YNumber = math.max(obj1.y,obj2.y) - math.min(obj1.y,obj2.y)
distance = XNumber + YNumber
return distance
end