define(["jquery","animation","sprites"],function(e,t,n){var r=Class.extend({init:function(e,t){this.name=e,this.scale=t,this.isLoaded=!1,this.offsetX=0,this.offsetY=0,this.loadJSON(n[e])},loadJSON:function(e){this.id=e.id,this.filepath="img/"+this.scale+"/"+this.id+".png",this.animationData=e.animations,this.width=e.width,this.height=e.height,this.offsetX=e.offset_x!==undefined?e.offset_x:-16,this.offsetY=e.offset_y!==undefined?e.offset_y:-16,this.load()},load:function(){var e=this;this.image=new Image,this.image.src=this.filepath,this.image.onload=function(){e.isLoaded=!0,e.onload_func&&e.onload_func()}},createAnimations:function(){var e={};for(var n in this.animationData){var r=this.animationData[n];e[n]=new t(n,r.length,r.row,this.width,this.height)}return e},createHurtSprite:function(){var e=document.createElement("canvas"),t=e.getContext("2d"),n=this.image.width,r=this.image.height,i,s;e.width=n,e.height=r,t.drawImage(this.image,0,0,n,r);try{i=t.getImageData(0,0,n,r),s=i.data;for(var o=0;o1&&!l(u(t.x-1,t.y))?!0:t.y1&&!l(u(t.x,t.y-1))?!0:!1},l=function(e){return e<0||e>=o.length?!0:o[e]===0&&o[e+1]===0&&o[e+2]===0&&o[e+3]===0};for(var c=0;c