mirror of
https://github.com/doublespeakgames/adarkroom.git
synced 2026-05-28 00:01:54 +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() {
|
||||
return Math.abs(World.curPos[0] - World.RADIUS) + Math.abs(World.curPos[1] - World.RADIUS);
|
||||
getDistance: function(from, to) {
|
||||
from = from || World.curPos;
|
||||
to = to || World.VILLAGE_POS;
|
||||
return Math.abs(from[0] - to[0]) + Math.abs(from[1] - to[1]);
|
||||
},
|
||||
|
||||
getTerrain: function() {
|
||||
|
||||
Reference in New Issue
Block a user