diff --git a/src/scripts/view/battle/Arena.ts b/src/scripts/view/battle/Arena.ts index 39bd4a3..165b36b 100644 --- a/src/scripts/view/battle/Arena.ts +++ b/src/scripts/view/battle/Arena.ts @@ -64,17 +64,16 @@ module SpaceTac.View { destroy() { this.game.input.deleteMoveCallback(this.input_callback); + super.destroy(); } // Initialize state (create sprites) init(): void { - var arena = this; - // Add ship sprites - this.battleview.battle.play_order.forEach(function (ship: Game.Ship) { - var sprite = new ArenaShip(arena.battleview, ship); - arena.addChild(sprite); - arena.ship_sprites.push(sprite); + this.battleview.battle.play_order.forEach((ship: Game.Ship) => { + var sprite = new ArenaShip(this.battleview, ship); + this.addChild(sprite); + this.ship_sprites.push(sprite); }); } diff --git a/src/scripts/view/battle/BattleView.ts b/src/scripts/view/battle/BattleView.ts index 6d3cb91..72e96d2 100644 --- a/src/scripts/view/battle/BattleView.ts +++ b/src/scripts/view/battle/BattleView.ts @@ -106,11 +106,9 @@ module SpaceTac.View { // Start processing the battle log this.log_processor = new LogProcessor(this); - // Handle space bar to end turn - this.space_key = this.game.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); + // Key mapping + this.space_key = this.input.keyboard.addKey(Phaser.Keyboard.SPACEBAR); this.space_key.onUp.add(this.onSpaceKeyPressed, this); - - // Shortcuts var key_s = this.input.keyboard.addKey(Phaser.Keyboard.S); key_s.onUp.add(() => { (this.game).saveGame();