mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-06-24 05:12:30 +08:00
world.js: Increase functionality of getDistance
Allow passing 'from' and 'to' positions to getDistance to find the distance between them.
This commit is contained in:
+4
-2
@@ -419,8 +419,10 @@ var World = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
getDistance: function() {
|
getDistance: function(from, to) {
|
||||||
return Math.abs(World.curPos[0] - World.RADIUS) + Math.abs(World.curPos[1] - World.RADIUS);
|
from = from || World.curPos;
|
||||||
|
to = to || World.VILLAGE_POS;
|
||||||
|
return Math.abs(from[0] - to[0]) + Math.abs(from[1] - to[1]);
|
||||||
},
|
},
|
||||||
|
|
||||||
getTerrain: function() {
|
getTerrain: function() {
|
||||||
|
|||||||
Reference in New Issue
Block a user