reenabled diagonal movement

This commit is contained in:
kharhamel 2020-04-30 19:36:28 +02:00
parent 62d2498e34
commit dd0744387f
3 changed files with 20 additions and 25 deletions

View file

@ -22,18 +22,15 @@ export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
this.setVelocity(x, y);
//todo improve animations to better account for diagonal movement
if (this.body.velocity.x > 0) { //moving right
this.play(PlayerAnimationNames.WalkRight, true);
}
if (this.body.velocity.x < 0) { //moving left
this.anims.playReverse(PlayerAnimationNames.WalkLeft, true);
}
//up or down animationss are prioritized over left and right
if (this.body.velocity.y < 0) { //moving up
this.play(PlayerAnimationNames.WalkUp, true);
}
if (this.body.velocity.y > 0) { //moving down
} else if (this.body.velocity.y > 0) { //moving down
this.play(PlayerAnimationNames.WalkDown, true);
} else if (this.body.velocity.x > 0) { //moving right
this.play(PlayerAnimationNames.WalkRight, true);
} else if (this.body.velocity.x < 0) { //moving left
this.anims.playReverse(PlayerAnimationNames.WalkLeft, true);
}
if(this.bubble) {