Skip to content

Commit

Permalink
Fixing player pseudo text not disappearing
Browse files Browse the repository at this point in the history
  • Loading branch information
fsioni committed Apr 22, 2023
1 parent 3ca2584 commit 43fcd63
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions client/src/phaser/gameObjects/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ export default class Player extends Phaser.GameObjects.Sprite {
this.handleRotation(delta);
}

removeText() {
this.playerText.destroy();
}

handleSocketEvents() {
if (this.socket) {
this.socket?.on("kill", () => {
Expand Down
1 change: 1 addition & 0 deletions client/src/phaser/scenes/GameScene.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export default class GameScene extends Phaser.Scene {
);

if (!dataPlayer) {
player.removeText();
player.destroy();
this.players = this.players.filter((p: Player) => p.id !== player.id);
return;
Expand Down

0 comments on commit 43fcd63

Please sign in to comment.