Merge branch 'refactoring_messages' into feature/login-page

# Conflicts:
#	front/src/Phaser/Player/Player.ts
This commit is contained in:
gparant 2020-05-06 01:58:04 +02:00
commit 4e04357b71
2 changed files with 11 additions and 5 deletions
front/src/Phaser

View File

@ -77,7 +77,7 @@ export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
stop(){
this.setVelocity(0, 0);
this.play(PlayerAnimationNames.None, true);
this.anims.stop();
}
say(text: string) {

View File

@ -59,7 +59,6 @@ export class Player extends PlayableCaracter implements CurrentGamerInterface, G
moveUser(delta: number): void {
//if user client on shift, camera and player speed
let haveMove = false;
let direction = null;
let activeEvents = this.userInputManager.getEventListForGameTick();
@ -84,11 +83,18 @@ export class Player extends PlayableCaracter implements CurrentGamerInterface, G
}
if (x !== 0 || y !== 0) {
this.move(x, y);
this.emit(hasMovedEventName, {direction, x: this.x, y: this.y});
} else {
if (this.previousMove !== PlayerAnimationNames.None) {
direction = PlayerAnimationNames.None;
this.stop();
this.emit(hasMovedEventName, {direction, x: this.x, y: this.y});
}
}
if (direction !== null) {
this.previousMove = direction;
}
this.emit(hasMovedEventName, {direction, x: this.x, y: this.y, frame: this.PlayerTexture});
}
//todo: put this method into the NonPlayer class instead