public/js-roguelike-skeleton/src/multi-object-manager.js
function(x, y, obj) {
            if(typeof obj === 'string'){
                obj = this.makeNewObjectFromType(obj);
            }
            obj.game = this.game;
            obj.x = x;
            obj.y = y;
            this.objects.push(obj);
            var arr = this.map.get(x, y);
            arr.push(obj);
            if(obj.onAdd){
                obj.onAdd();
            }
            return obj;
        }
function(x, y, obj) {
            if(typeof obj === 'string'){
                obj = this.makeNewObjectFromType(obj);
            }
            obj.game = this.game;
            obj.x = x;
            obj.y = y;
            this.objects.push(obj);
            var arr = this.map.get(x, y);
            arr.push(obj);
            if(obj.onAdd){
                obj.onAdd();
            }
            return obj;
        }
function ( x , y , obj ) { if ( typeof obj === 'string' ) { obj = this . makeNewObjectFromType ( obj ) ; } obj . game = this . game ; obj . x = x ; obj . y = y ; this . objects . push ( obj ) ; var arr = this . map . get ( x , y ) ; arr . push ( obj ) ; if ( obj . onAdd ) { obj . onAdd ( ) ; } return obj ; }
Adds an object to the manager at given map tile coord. Multiple objects can be added to the same coord.
@method add
@param {Number} x - Map tile coord x.
@param {Number} y - Map tile coord y.
@param {Object|String} obj - The Object being set at given coords. If `obj` is a string a new Object will be created using `this.makeNewObjectFromType(obj)`.
@return {Object} The added object.
Adds an object to the manager at given map tile coord . Multiple objects can be added to the same coord .