Quick Player Updates

This commit is contained in:
Brian Fertig 2025-07-29 08:28:20 -06:00
parent 1a9d041cac
commit a57c8a0334
1 changed files with 1 additions and 5 deletions

View File

@ -88,12 +88,10 @@ export class Player extends Phaser.GameObjects.Sprite {
// Movement: Up/Down:
if (this.scene.cursors.up.isDown) {
this.body.setVelocityY(-200);
this.body.setVelocityX(0);
this.anims.play('south', true);
this.facing = 'south';
} else if (this.scene.cursors.down.isDown) {
this.body.setVelocityY(200);
this.body.setVelocityX(0);
this.anims.play('north', true);
this.facing = 'north';
} else {
@ -103,13 +101,11 @@ export class Player extends Phaser.GameObjects.Sprite {
// Movement: Left/Right:
if (this.scene.cursors.left.isDown) {
this.body.setVelocityX(-200);
this.body.setVelocityY(0);
this.setFlipX(false);
this.anims.play('side', true);
this.facing = 'west';
} else if (this.scene.cursors.right.isDown) {
this.body.setVelocityX(200);
this.body.setVelocityY(0);
this.setFlipX(true);
this.anims.play('side', true);
this.facing = 'east';
@ -118,7 +114,7 @@ export class Player extends Phaser.GameObjects.Sprite {
}
// Idle
if (this.body.velocity.x === 0) {
if (this.body.velocity.x === 0 && this.body.velocity.y === 0) {
this.anims.play('idle', true);
}
}