Unity Tutorial 04

Here is the last part of the previous Unity Tutorial 03.

Collide

This part of the tutorial was called Collision Decisions.

The game was coming along nicely even though the Unity was closing down and freezing like 100 times but, but there were some things we must add before finishing the game. instead of pressing S to spawn the animals, I set them to spawn on a timer so that the animals appear every few seconds. Then i added colliders to all of the prefabs and made it so the launching projectile will make an animal destroy it. Last thing was to add a “Game Over” message if any animals make it past the player.

In doing all this I learnt how to program the animals to spawn on a timed interval and walk down the screen also triggering a “Game Over” message. That's if they make it past the player. And if the player hits them with a projectile to feed them, they will be destroyed.


And for the Challenge 2 I did I had to:

  1. Make the balls spawn from the top of the screen
  2. Make the player spawn dogs
  3. The balls should only be destroyed when coming into direct contact with a dog
  4. The balls and dogs should be destroyed when they leave the bottom of the screen.
  5. Ball 1, 2, and 3 should be spawned randomly
  6. Make the spawn interval a random value between 3 seconds and 5 seconds.

In doing all this I learnt how to program a random balls (3 in this case) to generate at a random x position above the screen. When the user presses the 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.

And that is all for this Tutorial.
-Tochi 👍

Comments

Popular Posts