Skip to content

Commit

Permalink
Hide player on death
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric L. Solis committed Nov 26, 2020
1 parent 3f5e5f4 commit b12e4d3
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/prefabs/player/Player.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ class Player extends Phaser.Physics.Arcade.Sprite {
this.setState(Player.CONFIG.STATES.DEAD);
this.animationManager.update();
this.physicsManager.reset();
this.visible = false;

// set dead sprite pos to match run|jump sprite pos (substract 4px)
this.setY(this.y - 4);
Expand All @@ -134,6 +135,7 @@ class Player extends Phaser.Physics.Arcade.Sprite {
* Reset player | Handle game restart
*/
reset() {
this.visible = true;
this.setState(Player.CONFIG.STATES.IDLING);
this.animationManager.update();
this.setY(Player.CONFIG.POS.Y);
Expand Down

0 comments on commit b12e4d3

Please sign in to comment.