Week 6 | Session 1 - Click the Flying Objects - April 27, 2020

Tutorial

·

Beginner

·

+10XP

·

60 mins

·

(31)

Unity Technologies

Week 6 | Session 1 - Click the Flying Objects - April 27, 2020

It’s time for the final unit! We will start off by creating a new project and importing the starter files, then switching the game’s view to 2D. Next we will make a list of target objects for the player to click on: Three “good” objects and one “bad”. The targets will launch spinning into the air after spawning at a random position at the bottom of the map. Lastly, we will allow the player to destroy them with a click!

1. Overview

This is the same content covered in Lesson 5.1 in the independent Create with Code Course.

What you will make:

  • A list of three good target objects and one bad target object will spawn in a random position at the bottom of the screen, thrusting themselves into the air with random force and torque. These targets will be destroyed when the player clicks on them or they fall out of bounds.

What you will learn:

  • Switch the game to 2D view for a different perspective
  • Add torque to the force of an object
  • Create a Game Manager object that controls game states as well as spawning
  • Create a List of objects and return their length with Count
  • Use While Loops to repeat code while something is true
  • Use OnMouseDown to enable the player to click on things

2. Before you Begin

To participate in this session and follow along, you need:

If this is your first Create with Code live learning session, you can catch up by:

  1. Following along with the recordings of our previous live learning sessions
  2. Completing the same lessons in the independent Create with Code Course

*Note - it is not necessary for you to catch up, but it is recommended for an ideal learning experience.

3. Recorded Live Session - 27th April - 9am PST

If you missed this session, you can catch up with the video below.

4. Recorded Live Session - 27th April - 5pm PST

If you missed this session, you can catch up with the video below.

5. Next Steps

Get caught up:

If you were not able to finish the session along with the instructors, you can catch up by:

  1. Re-watching this recorded session when it is posted in Step 3 above at 3am PT (10am UCT) the morning after this session's date
  2. Picking up where you left off in Lesson 5.1 of the independent Create with Code Course

Bonus Challenges:

  • Experiment with new features (after making a backup)
    • Dynamically change the spawn rate so they don’t predictably spawn at the exact same interval every time
    • [Difficult] Prevent objects from spawning directly underneath each other
  • Look ahead to the next lesson
    • If you want to go ahead and preview what we'll be covering in the next session, you can give it a try in Lesson 5.2 of the independent Create with Code Course.

Complete this tutorial