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