Game End, Score, and Restart


The game score will increase each time a projectile deactivates an alien i.e. the projectile reaches an alien. The game ends when the rocket is no longer active, i.e. an alien has crashed into the rocket.

ObjectManager

1. In the ObjectManager class, create a member integer called score and initialize it to zero.


2. Create a getter for the score variable.


3. Increment the score by one, every time an enemy is deactivated by a projectile (checkCollision).


GamePanel

4. Use the getScore method in the ObjectManager class to get the player's score and display it on the panel.


5. In the keyPressed method, when the ENTER key is pressed, check if the current state is equal to END. If it is, replace the existing inactive rocketship with a new Rocketship object.



6. Replace the existing ObjectManager with a new ObjectMangaer object, passing the rocketship object to the constructor.

TESTING

7. Run the program. Is the score displayed and does it update as you shoot the aliens? Does it reset to zero when you restart after a Game Over? Have you removed all your printing to the console? If so....congratulations! You have completed League Invaders!