public/js-roguelike-skeleton/src/util.js
function(x1, y1, x2, y2, diagonalMovement){
            if(!diagonalMovement){
                return Math.abs(x2 - x1) + Math.abs(y2 - y1);
            } else {
                return Math.max(Math.abs(x2 - x1), Math.abs(y2 - y1));
            }
        }
function(x1, y1, x2, y2, diagonalMovement){
            if(!diagonalMovement){
                return Math.abs(x2 - x1) + Math.abs(y2 - y1);
            } else {
                return Math.max(Math.abs(x2 - x1), Math.abs(y2 - y1));
            }
        }
function ( x1 , y1 , x2 , y2 , diagonalMovement ) { if ( ! diagonalMovement ) { return Math . abs ( x2 - x1 ) + Math . abs ( y2 - y1 ) ; } else { return Math . max ( Math . abs ( x2 - x1 ) , Math . abs ( y2 - y1 ) ) ; } }
Gets the distance in tile moves from point 1 to point 2.
@method getTileMoveDistance
@param {Number} x1
@param {Number} y1
@param {Number} x2
@param {Number} y2
@param {Bool} [diagonalMovement=false]if true, calculate the distance taking into account diagonal movement.
@return {Number}
Gets the distance in tile moves from point 1 to point 2 .