Skip to content

Commit

Permalink
fix spacebar rainbow weapon feature
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickschaffrath committed Oct 13, 2019
1 parent 6d3009a commit 8e435f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/objects/Player.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,12 @@ export class Player {
this._animate();
}

public removeShootListeners(): void {
public removeListeners(): void {
this._keys.Down.removeAllListeners();
this._keys.Up.removeAllListeners();
this._keys.Left.removeAllListeners();
this._keys.Right.removeAllListeners();
this._keys.Space.removeAllListeners();
}

public onHit(): void {
Expand Down Expand Up @@ -295,7 +296,7 @@ export class Player {
this._keys.Two.onDown = () => (this._currentElement = Element.Water);
this._keys.Three.onDown = () => (this._currentElement = Element.Earth);

this._keys.Space.onDown = () => {
this._keys.Space.on('down', () => {
this._swap.play();
switch (this._currentElement) {
case Element.Fire:
Expand All @@ -308,7 +309,7 @@ export class Player {
this._currentElement = Element.Fire;
break;
}
};
});
}

private _addShootListeners(): void {
Expand Down
2 changes: 1 addition & 1 deletion src/scenes/Room.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ export class Room extends Scene {
this._music.stop();
this.scene.stop();
this.scene.start('Death', { score: this._score.score });
this._player.removeShootListeners();
this._player.removeListeners();
return true;
}
return false;
Expand Down

0 comments on commit 8e435f5

Please sign in to comment.