More strict fixes
This commit is contained in:
parent
082a11b0cd
commit
6f69a62d4d
9 changed files with 52 additions and 51 deletions
|
@ -24,8 +24,8 @@ export const PLAYER_RESOURCES: Array<any> = [
|
|||
{name: "Female8", img: "resources/characters/pipoya/Female 16-4.png"/*, x: 128, y: 128*/}
|
||||
];
|
||||
|
||||
export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
|
||||
private bubble: SpeechBubble;
|
||||
export class PlayableCharacter extends Phaser.Physics.Arcade.Sprite {
|
||||
private bubble: SpeechBubble|null = null;
|
||||
private readonly playerName: BitmapText;
|
||||
public PlayerValue: string;
|
||||
public PlayerTexture: string;
|
||||
|
@ -91,8 +91,10 @@ export class PlayableCaracter extends Phaser.Physics.Arcade.Sprite {
|
|||
this.bubble = new SpeechBubble(this.scene, this, text)
|
||||
//todo make the bubble destroy on player movement?
|
||||
setTimeout(() => {
|
||||
this.bubble.destroy();
|
||||
this.bubble = null;
|
||||
if (this.bubble !== null) {
|
||||
this.bubble.destroy();
|
||||
this.bubble = null;
|
||||
}
|
||||
}, 3000)
|
||||
}
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import Scene = Phaser.Scene;
|
||||
import {PlayableCaracter} from "./PlayableCaracter";
|
||||
import {PlayableCharacter} from "./PlayableCharacter";
|
||||
|
||||
export class SpeechBubble {
|
||||
private bubble: Phaser.GameObjects.Graphics;
|
||||
|
@ -11,7 +11,7 @@ export class SpeechBubble {
|
|||
* @param player
|
||||
* @param text
|
||||
*/
|
||||
constructor(scene: Scene, player: PlayableCaracter, text: string = "") {
|
||||
constructor(scene: Scene, player: PlayableCharacter, text: string = "") {
|
||||
|
||||
let bubbleHeight = 50;
|
||||
let bubblePadding = 10;
|
||||
|
@ -76,13 +76,10 @@ export class SpeechBubble {
|
|||
this.content.setPosition(this.bubble.x + (bubbleWidth / 2) - (bounds.width / 2), this.bubble.y + (bubbleHeight / 2) - (bounds.height / 2));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
destroy(): void {
|
||||
this.bubble.setVisible(false) //todo find a better way
|
||||
this.bubble.destroy();
|
||||
this.bubble = null;
|
||||
this.content.destroy();
|
||||
this.content = null;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue