Week 2: Basic Gameplay - May 24 - 28
Exercise
·
Beginner
·
+0XP
·
60 mins
·
Unity Technologies

Join us Mondays and Thursdays at 9:00am PT by registering here.
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.
1. Before you begin
To participate in this session and follow along, you need:
- Unity 2020.3 (LTS) installed through the Unity Hub
- Complete content from the previous sessions
2. Week 2 Content
This week you'll complete Unit 2 from Create with Code, where you will learn the fundamentals of implementing basic gameplay elements while you create a game allowing players to throw food to hungry animals.
After the live session Monday where we kick off the project together, use the links below to continue working through the Unit independently.
- 2.1 - Player Positioning
- You will first choose which character you would like, which types of animals you would like to interact with, and which food you would like to feed those animals. You will give the player basic side-to-side movement just like you did in Prototype 1, but then you will use if-then statements to keep the Player in bounds.
- You will first choose which character you would like, which types of animals you would like to interact with, and which food you would like to feed those animals. You will give the player basic side-to-side movement just like you did in Prototype 1, but then you will use if-then statements to keep the Player in bounds.
- 2.2 - Food Flight
- In this lesson, you will allow the player to launch the projectile through the scene.
- 2.3 - Random Animal Stampede
- In this lesson we will allow the animals to spawn on their own, in a random location at the top of the screen.
- 2.4 - Collision Decisions
- Our game is coming along nicely, but there are are some critical things we must add before it’s finished. First off, instead of pressing S to spawn the animals, we will spawn them on a timer so that they appear every few seconds. Next we will add colliders to all of our prefabs and make it so launching a projectile into an animal will destroy it. Finally, we will display a “Game Over” message if any animals make it past the player.
Optional Content
- Unit 2 Challenge - Play Fetch
- 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.
- Unit 2 Quiz
- Assess your knowledge of the skills and concepts learned in Unit 1.
- Bonus Content
- Easy: Vertical player movement
- Medium: Aggressive animals
- Hard: Game user interface
- Expert: Animal hunger bar
Jr. Programmer Content
3. Live Sessions -Monday, May 24 Thursday, May 27
Monday May 24th Recording:
Thursday Session Recording:
Friday Session Recording:
4. Share your Modified Challenge or Prototype
If you went above and beyond and modified the challenge or prototype from this week, take a screenshot or screen-recording and post it here to share what you made! To upload your project online as a WebGL build so others can play it, you can:
- Follow the instructions to build your project for WebGL.
- Share a link in your submission description below so other people know where to find it.
Please also share any "behind-the-scenes" info about how you made your project!