A helper module for dealing with locations. You can assign these to units, tiles, whatever.
var Location = ;var myLocation = '2:3';var hugeArrayOfLocations = location ...hugeArrayOfLocations;
var Location = require('location');
Location object at
var loc = '8:8'`
is equivalent to:
var loc = 88
Returns (x,y) coordinates as a string, separated by a colon.
var location = 5 4;location -> '5:4'
Compare two location objects, and it will return a
y values must match to be
var location1 = 5 4;var location2 = 5 4;location1 -> truevar location3 = 2 8;var location4 = 2 2;location3 -> false
Compare two location objects. If adjacent, returns
var location1 = 5 4;var location2 = 5 3;location1 -> true
Returns a new instance of
Location with the same values.
npm install habitants-location