Wednesday 26 February 2020

Unity Tutorial 05

In this continuation Unity Tutorial we learnt how to create a random spawn of animals in our game but this time we used code in order to help spawn the animals at random times without the player having to click the 'S' key on their keyboard as the game will do that automatically for us.

Next - the animals spawn perfectly and the player can fire projectiles at them, but nothing happens when the two collide, so this is where we learnt how to add colliders so that the projectiles and animals get destroyed on collision. Moving aside from using C#, we move onto Unity to add these colliders to the game. A problem I encountered while applying the box colliders was - when overriding the animals my moose did not have a button for 'Apply All' - yet the other two animals did.

Adding colliders to Animals and Game Object.

After adding the box colliders to the animals and the object (in my case - steak), the tutorial then went on to show us the code for this collision to work and when made contact the animal and steak would disappear from the gameplay.

No comments:

Post a Comment