added som ebasic speech bubbles
This commit is contained in:
parent
05379c8001
commit
c51f5f4aa9
5 changed files with 83 additions and 3 deletions
|
@ -1,7 +1,9 @@
|
|||
import {getPlayerAnimations, playAnimation, PlayerAnimationNames} from "../Player/Animation";
|
||||
import {ActiveEventList, UserInputEvent} from "../UserInput/UserInputManager";
|
||||
import {SpeechBubble} from "./SpeechBubble";
|
||||
|
||||
export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
|
||||
private bubble: SpeechBubble;
|
||||
|
||||
constructor(scene: Phaser.Scene, x: number, y: number, texture: string, frame?: string | number) {
|
||||
super(scene, x, y, texture, frame);
|
||||
|
@ -29,4 +31,14 @@ export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
|
|||
this.play(PlayerAnimationNames.WalkDown, true);
|
||||
}
|
||||
}
|
||||
|
||||
say(text: string) {
|
||||
if (this.bubble) return;
|
||||
this.bubble = new SpeechBubble(this.scene, this, text)
|
||||
//todo make the buble destroy on player movement?
|
||||
setTimeout(() => {
|
||||
this.bubble.destroy();
|
||||
this.bubble = null;
|
||||
}, 3000)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue