I have a simple flash game with a spaceship and enemy ships. When my player gets hit and killed, the lives text field should subtract one, and then a new ship should appear. The first time the player ship dies, this all works. But starting the second time, the lives counter starts increasing by 1 every time the player ship is hit, I have no idea why. Here's my code pertaining to the player dieing:
Any help or suggestions are greatly appreciated.Code:private function playerKilled(e:Event) : void { scoreBar.updateLives(-1); } private function removePlayer(e:Event) { ourShip = new Ship(stage); stage.addChild(ourShip); ourShip.x = stage.stageWidth / 2; ourShip.y = stage.stageHeight / 2; } ourShip.addEventListener("killed", playerKilled, false, 0, true); public function takeHit() : void { dispatchEvent(new Event("killed")); removeSelf();


Reply With Quote
