workadventure/front/src/Phaser/Entity/CustomizedCharacter.ts

21 lines
610 B
TypeScript
Raw Normal View History

import Container = Phaser.GameObjects.Container;
2021-09-06 14:27:54 +02:00
import type { Scene } from "phaser";
import Sprite = Phaser.GameObjects.Sprite;
/**
* A sprite of a customized character (used in the Customize Scene only)
*/
export class CustomizedCharacter extends Container {
public constructor(scene: Scene, x: number, y: number, layers: string[]) {
super(scene, x, y);
this.updateSprites(layers);
}
public updateSprites(layers: string[]): void {
this.removeAll(true);
for (const layer of layers) {
this.add(new Sprite(this.scene, 0, 0, layer));
}
}
}