transmit companion to remote players
This commit is contained in:
parent
2ad712807b
commit
c07079051a
19 changed files with 96 additions and 40 deletions
|
@ -21,14 +21,17 @@ export class Player extends Character implements CurrentGamerInterface {
|
|||
texturesPromise: Promise<string[]>,
|
||||
direction: PlayerAnimationDirections,
|
||||
moving: boolean,
|
||||
private userInputManager: UserInputManager
|
||||
private userInputManager: UserInputManager,
|
||||
companion: string|null
|
||||
) {
|
||||
super(Scene, x, y, texturesPromise, name, direction, moving, 1);
|
||||
|
||||
//the current player model should be push away by other players to prevent conflict
|
||||
this.getBody().setImmovable(false);
|
||||
|
||||
this.addCompanion();
|
||||
if (typeof companion === 'string') {
|
||||
this.addCompanion(companion);
|
||||
}
|
||||
}
|
||||
|
||||
moveUser(delta: number): void {
|
||||
|
@ -61,10 +64,6 @@ export class Player extends Character implements CurrentGamerInterface {
|
|||
moving = true;
|
||||
}
|
||||
|
||||
if (this.companion) {
|
||||
this.companion.step(delta);
|
||||
}
|
||||
|
||||
if (x !== 0 || y !== 0) {
|
||||
this.move(x, y);
|
||||
this.emit(hasMovedEventName, {moving, direction, x: this.x, y: this.y});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue