Hmm…Wave sequencing, why don’t we try and start with something that should be fairly simple? Let’s make it so that the first wave spawns only 5 enemies, second 10 enemies and the third unlimited.
In order to accomplish this we should probably create a new script and call it; let’s…
Googling “camera shake unity” gives us the following code to pilfer:
Creating a script called CameraBehaviour, and adding it to our Main camera and then adding the above method to this script.
Adding the following variable to our Player script:
Before we can have the player fire a missile, we need a way to set our _closestEnemy variable to the closest enemy. Googling ‘nearest target unity’ and searching through gives us the following code to pilfer:
We can add this method to the MissileBehaviour script as well as adding the…
First thing we need to do is create a missile object and then create and attach a script to it; let’s say MissileBehaviour. Adding the following method to this script:
We will also need to add a variable _missleSpeed and set it to say 5. …
Since we have allowed the enemy to shoot and damage the player, maybe we should add a collectable that can heal. In order to accomplish this, we will need to add another case to our powerup script, such as:
Then we need to add this new method to our player…
I guess since we limited the number of times our player can fire, we should add a collectable that will refill the ammo. In order to accomplish this, we will need to add another case to our powerup script, such as:
Then we need to add this new method to our player script.
First we will need to add a variable to our player script as below:
Then we will need to add the below to the playerMovement() method of our player script: