Unity Learn home
View Project Content

Week 3: Basic Gameplay | Apr 6 - Apr 10

+300 XP
5 Hours
This week, you will program a top-down game with the objective of throwing food to hungry animals - who are stampeding towards you - before they can run past you. In order to do this, you will become much more familiar with some of the most important programming and Unity concepts, including if-then statements, random value generation, arrays, collision detection, prefabs, and instantiation. In completing this week's sessions, you will learn how to program a basic game with the ability to launch projectiles and maneuver the player to keep the game alive.
Project Objective
By the end of this week, you will be able to:
  • Create an if-then statement in order to implement basic logic in your project, including the use of greater than (>) and less than (<) operators
  • Transform a gameobject into a prefab that can be instantiated into the scene
  • Work with prefabs to add efficiencies in your workflows
  • Get user input with GetKey and KeyCode to test for specific keyboard presses
  • Use arrays to create an accessible list of objects or values and randomly select an object from that array
  • Randomly generate values to randomize spawn positions
  • Change the camera’s perspective to better suit your game
  • Repeat functions on a timer with InvokeRepeating
  • Write custom methods to make your code more readable
  • Detect collisions and destroy objects that collide with each other
  • Display messages in the console with Debug Log
Select your Unity version
Last updated: April 22, 2020