this.spritesheet = spritesheet;
}
controllSpriteSheetPainter.prototype = {
advance:function(){
if(this.isActive){
this.cellIndex++;
if(this.cellIndex === this.cells.length){
this.cellIndex = 0;
this.isActive = false;
}
}
},
paint:function(sprite){
if(this.dateCount===null){
this.dateCount = new Date();
}else {
var newd = new Date();
var tc = newd-this.dateCount;
if(tc>sprite.firePerFrame){
this.advance();
this.dateCount = newd;
}
}
var cell = this.cells[this.cellIndex];
ctx.drawImage(this.spritesheet , cell.x , cell.y , cell.w , cell.h , -planWidth/2 , -planHeight/2 , cell.w , cell.h);









