class Objective { constructor(x,y,w,h,imgName,callback) { this.x = x; this.y = y; this.w = w; this.h = h; this.imgName = imgName; this.callback = callback; } } Objective.prototype.draw = function() { imgIgnoreCutoff(sprites[this.imgName],this.x,this.y,0,4,4); } Objective.prototype.update = function() { if(rectrect(this,player)) { for(var j=0;j<50;j++) { Particles.push(new Particle(this.x,this.y)); } this.callback(); return true; } return false; } var Objectives = []; function updateObjectives() { for(var i=0;i