public/js-roguelike-skeleton/src/multi-object-manager.js
function(x, y, filter){
            var arr = this.map.get(x, y);
            if(arr){
                if(filter){
                    for(var i = arr.length - 1; i >= 0; i--){
                        var item = arr[i];
                        if(filter(item)){
                            return item;
                        }
                    }
                } else {
                    return arr[arr.length - 1];
                }
            }
        }
function(x, y, filter){
            var arr = this.map.get(x, y);
            if(arr){
                if(filter){
                    for(var i = arr.length - 1; i >= 0; i--){
                        var item = arr[i];
                        if(filter(item)){
                            return item;
                        }
                    }
                } else {
                    return arr[arr.length - 1];
                }
            }
        }
function ( x , y , filter ) { var arr = this . map . get ( x , y ) ; if ( arr ) { if ( filter ) { for ( var i = arr . length - 1 ; i >= 0 ; i -- ) { var item = arr [ i ] ; if ( filter ( item ) ) { return item ; } } } else { return arr [ arr . length - 1 ] ; } } }
Retrieves the last object in array at given map tile coord.
@method getLast
@param {Number} x - The tile map x coord.
@param {Number} y - The tile map y coord.
@param {Function} [filter] - A function to filter the object returned at this map tile coord `function(object){  return true }`. The last object in the array the filter matches is returned.
@return {Object}
Retrieves the last object in array at given map tile coord .