谁能帮我解决这个问题:http: //jsfiddle.net/B5UsC/20/
你可以看到当卷轴在最后一帧动画时精灵动画没有正确渲染Hardpunch
播放特定帧时可以改变角色宽度吗?就像你看到我的 spritesheet 不包含静态宽度和高度,所以这对我来说有点混乱
编码 :
// initialize the sprite
Crafty.sprite("http://i.imgur.com/bkYVEe5.png", {
Ryu: [0, 0, plrw, plrh]
});
// initialize the component
Crafty.c("RyuAnimation", {
init: function () {
this.requires("SpriteAnimation,Keyboard")
.addComponent("Ryu")
.reel('idle', 300, [
[0, 0],
[plrw * 1, 0],
[plrw * 2, 0],
[plrw * 3, 0]
])
.reel('punch', 300, [
[plrw + 12, plrh],
[plrw * 2 + 15, plrh]
])
.reel('Hardpunch', 300, [
[plrw * 3 - 25, plrh],
[plrw * 4 + 32, plrh],
[(plrw + 19) * 5 - 38, plrh]
]); //
this.animate("idle", -1);
}
// creating the player
plr1 = Crafty.e("2D,Canvas,RyuAnimation")
.attr({
x: 15,
y: ch - 100
})
.start(3);
this.bind('KeyDown', function () {
if (this.isDown('A')) {
if (!this.isPlaying("Hardpunch")) {
this.pauseAnimation().animate("Hardpunch", 1);
}
} else {
this.stop();
}
});
我阅读了有关处理具有不同宽度和高度的复杂精灵表的信息,所有答案都是关于为所有精灵创建大小均匀的框,例如此处的示例:https ://gamedev.stackexchange.com/questions/48225/how-do-i- support-animation-with-frames-of-different-sizes 但我实际上无法理解这是什么意思以及我将如何做到这一点,他们没有提供示例。什么是evenly sized boxes
?