(function() { "use strict"; var ButcherSystem = function() { this.initialize(); } var p = ButcherSystem.prototype = new creatine.System(); p.initialize = function() { this._removeQueue = []; } p.process = function(boids, wolfs) { for (var i=boids.length-1; i>=0; i--) { var b = boids[i]; if (this._verifyDeathSquare(b) || this._verifyPredator(b, wolfs)) { b.getComponent('Flock').dead = true; boids.splice(i, 1); } } } p.getRemoveQueue = function() { return this._removeQueue; } p._verifyDeathSquare = function(b) { var px = b.display.x; var py = b.display.y; var tx = toCoordX(px); var ty = toCoordY(py); var death = registry.map.getLayerByName('area_death'); if (px < -5 || px > canvas.width+5 || py < -5 || py > canvas.height+5 || getTile(death, tx, ty)) { this._removeQueue.push(b); return true; } } p._verifyPredator = function(b, wolfs) { for (var i=0; i