Added jumping "animation".

This commit is contained in:
Jeasonfire 2015-05-27 13:47:52 +03:00
parent 1ab50f7f33
commit b466dd8cc5
2 changed files with 9 additions and 0 deletions

View File

@ -141,6 +141,12 @@ public class EntityFactory {
.addSprite(playerSprites[1][9][1]);
renderedObject.addSequence("Legs-Run-Left", legsRunLeftSequence);
// Jumping animation
SpriteSequence legsJumpRightSequence = new SpriteSequence(SWING_ANIMATION_SPEED).addSprite(playerSprites[1][8][0]);
renderedObject.addSequence("Legs-Jump-Right", legsJumpRightSequence);
SpriteSequence legsJumpLeftSequence = new SpriteSequence(SWING_ANIMATION_SPEED).addSprite(playerSprites[1][8][1]);
renderedObject.addSequence("Legs-Jump-Left", legsJumpLeftSequence);
// Combat animations
SpriteSequence torsoCombatRightSequence = new SpriteSequence(SWING_ANIMATION_SPEED).addSprite(playerSprites[0][7][0])
.addSprite(playerSprites[0][8][0]).addSprite(playerSprites[0][9][0]).addSprite(playerSprites[0][10][0]);

View File

@ -222,6 +222,9 @@ public class RenderingSystem extends EntitySystem {
ro.playAnimation("torso", "Torso-Idle-" + dirMove);
ro.playAnimation("legs", "Legs-Idle-" + dirMove);
}
if (!po.isGrounded()) {
ro.playAnimation("legs", "Legs-Jump-" + dirMove);
}
}
private void tryToMakeStepSound(CPhysics po) {