我想在 Run 和 Jump 动画之间切换,但我有一些问题:如果 Player 运行并且我点击屏幕,Player 开始 Jumping(一次),Jumpanimation 开始但不结束,所以玩家正在运行与 Jumpanimation。
你知道我的错在哪里吗?我的代码:
// Runanimation + Player Run
public void setRunning()
{
canRun = true;
final long[] PLAYER_ANIMATE = new long[] { 100, 100, 100,};
animate(PLAYER_ANIMATE, 0, 2, true);
}
// Jumpanimation + Player Jump
public void jump()
{
if (footContacts < 1)
{
return;
}
body.setLinearVelocity(new Vector2(body.getLinearVelocity().x, 10));
final long[] PLAYER_JUMP_ANIMATE = new long[] { 100, 100, 100, 100, 100, 100};
animate(PLAYER_JUMP_ANIMATE, 0, 5,true);
}
谢谢你