ackvonhuelioLvl 41
so basically i have
var effects = [];
function effect(){
// all other properties removed for simplicity of this post
this.index = effects.length;
effects.push(this);
}
and to get rid of the effect i have this:
effect.prototype.terminate = function(){
for(var i = this.index+1; i < effects.length; i++){
effects[i].index--;
}
effects.splice(this.index,1);
};
this feels kinda sloppy and error prone, yet i can't think of a better way to terminate the effects. anyone know of a faster and/or more reliable way to do this(mostly need faster)?