我正在开发一个精灵必须向前跳跃的游戏。我已经探索过它并使用 MoveYModifier 向上,然后 MoveYModifier 再次向下,它工作正常,除了在屏幕上点击一次以上。但我想在跳跃时也让他向前移动。
final Entity playerEntity = move;
final float jumpDuration = 3;
final float startX = playerEntity.getX();
final float jumpHeight = 100;
final MoveXModifier moveUpModifier = new MoveXModifier(jumpDuration / 2, startX, startX - jumpHeight); // - since we want the sprite to go up.
final MoveXModifier moveDownModifier = new MoveXModifier(jumpDuration / 2,startX - jumpHeight, startX);
final SequenceEntityModifier modifier = new SequenceEntityModifier(moveUpModifier, moveDownModifier);
playerEntity.registerEntityModifier(modifier);
return true;