Unity Learn home
View Tutorial Content

Challenge 2 - Play a Game of Fetch

+10 XP
1 Hour
Challenge Overview:
Use your array and random number generation skills to program this challenge where balls are randomly falling from the sky and you have to send your dog out to catch them before they hit the ground. To complete this challenge, you will have to make sure your variables are assigned properly, your if-statements are programmed correctly, your collisions are being detected perfectly, and that objects are being generated randomly. Finally you will continue practicing your bug reporting skills.
Challenge Outcome:
  • 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
  • A detailed bug report
Select your Unity version
Last updated: July 16, 2020
Challenge 2 - Play a Game of Fetch