Unity Tutorials 04
Unity Tutorial
Moving on from the last tutorial, the player has to press S to spawn new animals, which makes no sense. In this tutorial I learn how to make a new method to spawn new animals automatically, I started by writing my very first custom function in the SpawnManager script.
I then moved on to making the animals spawn on a timer so the animals can appear every few seconds. I then give both the projectiles and animals some familiar components 'colliders', so they can be destroyed on collision.
I then code a new script in order to destroy both the animals and projectiles on impact. If the animals get past the player, A 'game over' message pops up to let the player know they lost.
Next, I completed a challenge and quiz where balls are randomly falling from the sky and I have to send my dog out to catch them before they hit the ground.
Here are the challenge outcomes:
- A random ball (of 3) is generated at a random x position above the screen
- When the user presses spacebar, a dog is spawned and runs to catch the ball
- If the dog collides with the ball, the ball is destroyed
- If the ball hits the ground, a 'game over' debug message is displayed
- The dogs and balls are removed from the scene when they leave the screen.
Comments
Post a Comment