Unity Learn home
View Tutorial Content

Challenge 2 - Play Fetch

Tutorial
Beginner
+10 XP
1 Hour
(24448)
Overview
Skills
For Educators
Summary
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.
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
Select your Unity version
Last updated: January 03, 2024
2022.3
2022.2
2022.1
2021.3
2021.2
2021.1
2020.3
2020.2
2020.1
2019.4
2019.3
2019.2
2019.1
2018.4
6
Language
English
Challenge 2 - Play Fetch