public/js-roguelike-skeleton/src/object-manager.js
function(x, y, object) {
            var existing = this.get(object.x, object.y);
            if(existing !== object){
                throw new Error({error: 'Attempting to move object not in correct position in Object manager', x: x, y: y, object: object});
            }

            if(this.objects.indexOf(object) === -1){
                throw new Error({error: 'Attempting to move object not in Object manager', x: x, y: y, object: object});
            }
            this.map.remove(object.x, object.y);
            this.map.set(x, y, object);
            object.x = x;
            object.y = y;
        }
function(x, y, object) {
            var existing = this.get(object.x, object.y);
            if(existing !== object){
                throw new Error({error: 'Attempting to move object not in correct position in Object manager', x: x, y: y, object: object});
            }

            if(this.objects.indexOf(object) === -1){
                throw new Error({error: 'Attempting to move object not in Object manager', x: x, y: y, object: object});
            }
            this.map.remove(object.x, object.y);
            this.map.set(x, y, object);
            object.x = x;
            object.y = y;
        }
function ( x , y , object ) { var existing = this . get ( object . x , object . y ) ; if ( existing !== object ) { throw new Error ( { error : 'Attempting to move object not in correct position in Object manager' , x : x , y : y , object : object } ) ; } if ( this . objects . indexOf ( object ) === - 1 ) { throw new Error ( { error : 'Attempting to move object not in Object manager' , x : x , y : y , object : object } ) ; } this . map . remove ( object . x , object . y ) ; this . map . set ( x , y , object ) ; object . x = x ; object . y = y ; }
Changes the position of an object already added to this objectManager.
@method move
@param {Number} x - The destination tile map coord x.
@param {Number} y - The destination tile map coord y.
@param {Obj} object - The objectity to be removed.
Changes the position of an object already added to this objectManager .