better woka preview, wip

This commit is contained in:
Piotr 'pwh' Hanusiak
2022-03-11 13:36:55 +01:00
parent 9f823506b9
commit 138e8aece4
7 changed files with 240 additions and 171 deletions
@@ -0,0 +1,28 @@
import { CustomizedCharacter } from "../../Entity/CustomizedCharacter";
import { PlayerAnimationDirections } from "../../Player/Animation";
export class CustomWokaPreviewer extends Phaser.GameObjects.Container {
private background: Phaser.GameObjects.Rectangle;
private character: CustomizedCharacter;
constructor(scene: Phaser.Scene, x: number, y: number) {
super(scene, x, y);
this.background = this.createBackground();
this.character = new CustomizedCharacter(scene, 0, 0, ["body19", "clothes4"]);
this.character.setScale(4);
this.setSize(this.background.displayWidth, this.background.displayHeight);
this.add([this.background, this.character]);
this.scene.add.existing(this);
}
public update(): void {
this.character.playAnimation(PlayerAnimationDirections.Down, true);
}
private createBackground(): Phaser.GameObjects.Rectangle {
return this.scene.add.rectangle(0, 0, 150, 300, 0xbfbfbf, 0.5);
}
}