Tutorial lesson 2.4

 In this tutorial I had to make it so that animals are spawned on a timer, that all the prefabs had colliders so that when they ended up touching that they where destroyed and finally I had to make the game say Game Over if an animal passed the player. To start I added a new function in Spawnmanager.cs so that whenever the S key was pressed and  animal would spawn in by copying and pasting the already present code into the new function. Then to get the animals to spawn randomly I had to add to private floats which included the start delay and the spawn interval time. Then I added InvokeRepeating and removed the if statement that allowed the player to spawn animals by pressing S. Then back in unity double click on an animal prefab and add the component box collider, edit the collider so that it is big enough to surround the prefab and repeat the process for the other prefabs. After check the is trigger box, then add the ridge body component to the projectile and uncheck the use gravity box. Then the new script detectcollision was added to all of the animal prefabs, then in the script add the a void function so that you can overwrite another function. In the destroyoutofbounds script a line of code in the else if statement so that if an animal passes the player it will say game over.



Comments

Popular posts from this blog

Introduction Post

Game Idea Research

Game Brainstorm