transmit companion to remote players

This commit is contained in:
Johannes Berthel 2021-04-02 21:21:11 +02:00
parent 2ad712807b
commit c07079051a
19 changed files with 96 additions and 40 deletions

View file

@ -71,8 +71,8 @@ export abstract class Character extends Container {
this.playAnimation(direction, moving);
}
public addCompanion(): void {
this.companion = new Companion(this.scene, this.x, this.y);
public addCompanion(name: string): void {
this.companion = new Companion(this.scene, this.x, this.y, name);
}
public addTextures(textures: string[], frame?: string | number): void {

View file

@ -17,12 +17,17 @@ export class RemotePlayer extends Character {
name: string,
texturesPromise: Promise<string[]>,
direction: PlayerAnimationDirections,
moving: boolean
moving: boolean,
companion: string|null
) {
super(Scene, x, y, texturesPromise, name, direction, moving, 1);
//set data
this.userId = userId;
if (typeof companion === 'string') {
this.addCompanion(companion);
}
}
updatePosition(position: PointInterface): void {