top of page
  • Writer's pictureandreahywong

Player Control (CWC-S2020: Week 1) - Quiz 1

Just some note-worthy point-form notes from the optional content from Week 1's tutorial!


Optional content


Unit 1 Challenge - Plane Programming

This Challenge required application of the skills learned from the Prototype tutorial in a whole new project. Instead of driving a vehicle on a road, we're fixing bugs and implementing features to navigate a plane!

Edit: This is one I want to dedicate a separate post for. It should be findable in #CreateWithCodeSummer2020!



Unit 1 Quiz


It's funny how something as simple as a 10-question quiz can provide such satisfaction.

Taking this quiz really made me feel like I was back in school. Some questions were pretty easy, but I thought there were definitely some questions that really made me question how comfortable I knew the material.. Here are some of the questions I felt were more challenging/ good summary questions to refer back to in the future:



  1. True or False: Visual Studio is not a part of Unity. You could use a different code editor to edit your C# scripts if you wanted to. True. Visual Studio is just one of many editors you could use to edit your code, including editors like Atom, Sublime, or even a basic Text Editor.

  2. In what order do you put the words when you are declaring a new variable? [access modifier ] [data type] [variable name] [variable value] Variables are always declared in the order:

    1. [access modifier] - public, private, etc

    2. [data type] - float, int, GameObject, etc

    3. [variable name] - speed, turnSpeed, player, offset, etc

    4. [variable value] - 1.0f, 2, new Vector3(0, 1, 0), etc

  3. What is a possible value for the horizontalInput variable? horizontalInput = Input.GetAxis("Horizontal"); 0.52 Input.GetAxis returns a float value between -1 and 1, which means 0.52 is a possible value.

  4. What is true about the following two lines of code? transform.Translate(Vector3.forward); transform.Tranlsate(1, 0 0); They wlil bloth move an object at the same speed. Vector3.forward is the equivalent of (0, 0, 1), which has the same magnitude as (1, 0, 0), even though they’re in different directions, so they would both move an object at the same speed, but along different axes.

  5. Which comment would best describe the code below? horizontalInput = Input.GetAxis("Horizontal"); transform.Rotate(Vector3.up, horizontalInput); // Rotates around the Y axis based on left/right arrow keys. Vector3.up is the Y axis and it’s using the Horizontal input value, so it would rotate around the Y axis when the user presses the left/right arrows.

  6. Where would you click to choose an alternative code editing tool? [picture of Unity Preferences > External Tools > ... ]

    1. External Script Editor: Visual Studio

    2. Image application: Open by file extension

    3. Revision Control Diff/Merge: Apple File Merge Quite frankly, I'm not sure what the other two are. Perhaps it'll be revealed/learned in the #future.


Bonus Challenges

Easy

This was pretty easy! Drag and drop and arrange where new obstacles should go.

Medium

I added some other cars and basically made them a VehicleControl script that did the first parts of our PlayerController script, automatically moving our vehicles forward (in the opposite direction) on GameStart.

Hard

This truly took some thinking...

Expert

Project Settings > remove Alternate > Duplicate Array of Axes > add new keys/inputs- - edit script to use new axis


Camera settings > Viewpoint Rect > W = 0.5 for half screen

  • && = and ! reverses logic using booleans as "state checkers"

Bonus Live from audience: The below are some notes I took the live session:

  • Pick up obstacles and add points

  • GameObject > 3D Objects (primitive shapes)

  • Collider Components

  • OnTriggerEnter() function --> tab key, fills entire function for you

  • Destroy()

  • component vs. variable in component

  • other.gameObject

  • Console tab for debugging: Debug.Log (printing out errors, warnings, logs etc...)

  • hit obstacle = -1; collect pick ups = +2 (hit everything = no. of pick ups)

  • add point variable

  • truck = 2000; tank = 5000 kg mass

1,352 views

Recent Posts

See All
bottom of page