Air Raid small bug in book?
I think I found a small bug in the book. When you finish the game and hit play again, sometimes the gun is stuck to the side of the screen.
This happens if you are holding down an arrow key when the last bullet runs out and it goes to game over.
at the end of the main class set the arrows to false...
stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDownFunction);
stage.removeEventListener(KeyboardEvent.KEY_UP, keyUpFunction);
removeEventListener(Event.ENTER_FRAME, checkForHits);
//new code : stop arrows from being "held down" while deciding if you want to play again
leftArrow = false;
rightArrow = false;
Copyright Gary Rosenzweig
