What's wrong with my code
At this stage, we'll add scorekeeping to the game. The player gets 15 points for each ordinary ship and 100 points for the boss.
It will be most convenient to keep score in the checkHit() method, after reworking it a little.
To store the total score, we'll add a score variable in the SpaceInvadersGame class. We'll display it on the screen using the Game class's setScore method.
Requirements:
- The EnemyShip class must have a public int score field that is initialized to 15 when it is declared.
- The Boss class's constructor must set the score field to 100.
- The EnemyFleet class must have a public int checkHit(List<Bullet> bullets) method.
- The EnemyFleet class must not have a public void checkHit(List<Bullet> bullets) method.
- The checkHit(List<Bullet> bullets) method must return 0 if the bullets list is empty.
- The checkHit(List<Bullet> bullets) method must return the sum of the values of the score fields of all of the objects in the ships list on which the kill() method is called.
- There must be a private int score field in the SpaceInvadersGame class.
- The score field must be initialized to 0 in the createGame() method.
- The onTurn(int) method must call the setScore(int) method with score as the argument.
- In the onTurn(int) method, the setScore(int) method must be called before the drawScene() method.
- In the check() method, the score field must be increased by the value returned by calling the checkHit(List<Bullet>) method on the enemyFleet object.
package com.codegym.games.spaceinvaders;
/**
* The direction of the moving object
*/
public enum Direction {
RIGHT, LEFT, UP, DOWN
}