UNPKG

matrix-map

Version:

A class object for to aid in the creation of 2D grid games.

10 lines (9 loc) 250 B
const getNorthNeighbor = function(id){ let northNeighbor = null; if(!this.northEdge.has(id)){ let edgeSize = Math.sqrt(this.size); northNeighbor = id-edgeSize; } return northNeighbor; } export default getNorthNeighbor