//这里是处理帧在图的位置的
Sprite_Actor.prototype.updateFrame = function() {
Sprite_Battler.prototype.updateFrame.call(this);
var bitmap = this._mainSprite.bitmap;
if (bitmap) {
var motionIndex = this._motion ? this._motion.index : 0;
var pattern = this._pattern < 3 ? this._pattern : 1;
var cw = bitmap.width / 9;
var ch = bitmap.height / 6;
var cx = Math.floor(motionIndex / 6) * 3 + pattern;
var cy = motionIndex % 6;
this._mainSprite.setFrame(cx * cw, cy * ch, cw, ch);
}
};
//更新动作计数 和这里处理帧的计数的
Sprite_Actor.prototype.updateMotionCount = function() {
if (this._motion && ++this._motionCount >= this.motionSpeed()) {
if (this._motion.loop) {
this._pattern = (this._pattern + 1) % 4;
} else if (this._pattern < 2) {
this._pattern++;
} else {
this.refreshMotion();
}
this._motionCount = 0;
}
};