[摘要][]; this.cellIndex = 0; this.dateCount = null; this.isloop = isloop; this.endCallback = end...
[];
this.cellIndex = 0;
this.dateCount = null;
this.isloop = isloop;
this.endCallback = endCallback;
this.spritesheet = spritesheet;
}
SpriteSheetPainter.prototype = {
advance:function(){
this.cellIndex = this.isloop?(this.cellIndex===this.cells.length-1?0:this.cellIndex+1):(this.cellIndex+1);
},
paint:function(sprite){
if(this.dateCount===null){
this.dateCount = new Date();
}else {
var newd = new Date();
var tc = newd-this.dateCount;
if(tc>40){
this.advance();
this.dateCount = newd;
}
}
if(this.cellIndex<this.cells.length
关键词:运用HTML5 Canvas制作一个容易的打飞机游戏