load texture inside game scene instead inside of inside companion class
This commit is contained in:
@@ -71,8 +71,10 @@ export abstract class Character extends Container {
|
||||
this.playAnimation(direction, moving);
|
||||
}
|
||||
|
||||
public addCompanion(name: string): void {
|
||||
this.companion = new Companion(this.scene, this.x, this.y, name);
|
||||
public addCompanion(name: string, texturePromise?: Promise<string>): void {
|
||||
if (typeof texturePromise !== 'undefined') {
|
||||
this.companion = new Companion(this.scene, this.x, this.y, name, texturePromise);
|
||||
}
|
||||
}
|
||||
|
||||
public addTextures(textures: string[], frame?: string | number): void {
|
||||
|
||||
@@ -18,7 +18,8 @@ export class RemotePlayer extends Character {
|
||||
texturesPromise: Promise<string[]>,
|
||||
direction: PlayerAnimationDirections,
|
||||
moving: boolean,
|
||||
companion: string|null
|
||||
companion: string|null,
|
||||
companionTexturePromise?: Promise<string>
|
||||
) {
|
||||
super(Scene, x, y, texturesPromise, name, direction, moving, 1);
|
||||
|
||||
@@ -26,7 +27,7 @@ export class RemotePlayer extends Character {
|
||||
this.userId = userId;
|
||||
|
||||
if (typeof companion === 'string') {
|
||||
this.addCompanion(companion);
|
||||
this.addCompanion(companion, companionTexturePromise);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user