Here are some of the changes I've made to my final project:
Pause Menu.
One of the major changes this week is the introduction of a pause menu, accessible with the Esc key. I wanted to be able to pause and reset the game whenever needed and the pause menu allows for that.
One issue that I will address soon is that, because of the way the game pauses, the player can turn but not move. Although I have introduced a variable for pausing in the necessary script, I will need to introduce it as a condition for turning.
EnemySpawner object.
One of the additions that was suggested to me by my teacher was a GameObject in Unity, that you could shoot down and that would spawn enemies. I thought it was a good idea and so I added it into the game. I made it so that the colour of the object reflected the health of the Spawner, and when the Spawner's health dipped to below or at 0, then it would spawn a number of enemies near the location of the spawner device.
This was fairly easy to program, as it mainly relies on the OnCollisionEnter2D function that I have used many times before in Unity. The trickiest part was the colour mechanism, as I wasn't able to directly change the colour of the sprite by using the health integer.
Eventually, I decided to just check for the object's health and have the function update according to the number.
void CheckHealthLevel()
{
if (eSpawnerHealth > 75)
{
_spriteRenderer.color = Color.white;
}
else if (eSpawnerHealth > 50)
{
_spriteRenderer.color = Color.black;
}
else if (eSpawnerHealth > 25)
{
_spriteRenderer.color = Color.blue;
}
}
No comments:
Post a Comment