Scoring enemy hits
As with most games, we need a scoring system to show how well the player has done at the end of the game. Typically, with side-scrolling shooter games, the player is rewarded for each kill they make. If we turn to our game framework diagram, we can see that ScoreManager
is hooked up to GameManager
like ScenesManager
was:
Our code for adding a scoring system will once again be minimal. We also want flexibility so that different enemies are worth different points. We also want it so that when we add another enemy to our game with a different scoring point, we can avoid altering our code each time.
We will be working with the following scripts in this section:
EnemyWave
ScoreManager
ScenesManager
SOActorModel
Since the scoring system is an integral factor in our game, it would make sense to add a simple integer to SOActorModel
that injects common values into our game objects...