transmit companion to remote players
This commit is contained in:
parent
2ad712807b
commit
c07079051a
19 changed files with 96 additions and 40 deletions
|
@ -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 {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue