Digital FXtbook
Easy Contacts
  • Home
    • Software
    • The Author
    • Former Students Hall of Fame
    • A tribute....
    • Treasure Hunt
  • Video Game Training
    • 3d Motion Graphics >
      • Unity >
        • Unity Essentials >
          • Unity's Interface >
            • Our First Assignment
          • Modeling and Level Design >
            • The Essentials
            • The Floor is Lava Name Project
            • ProBuilder >
              • ProBuilder Pro Skater Park
              • ProBuilder Pro Skater Park 2
              • ProBuilder Pro Skater Park 3
              • ProBuilder Pro Skater Park 4
              • ProBuilder Image Planes
              • ProBuilder Steve Modeling
              • ProBuilder Steve Texturing
          • Programming >
            • Getting Started with Scripting
            • Default Scripting
            • Scripting a Game Object
          • Real Time Audio >
            • Adding Background Music
            • 3-d Audio effects
          • 2d Essentials >
            • 2d Game Objects
            • Objects on 2d Game Objects
        • Creative Core >
          • Introduction to Creative Core
          • Shaders and Materials
          • Lighting
          • Animation
          • VFX
          • Cameras
          • Post Processing
          • Audio
          • User Interface
          • Proto-Typing
    • C# Programming >
      • Visual Studios >
        • First Program >
          • Getting input from the User
        • Comments >
          • PsuedoCode
        • Variable Types >
          • AlphaNumeric Variables
          • Numeric Variables
          • Putting it all together
        • Operators >
          • Assignment and Arithmetic Operators >
            • Use of Parenthesis
            • When is Easter??
          • Comparison and Logical Operators >
            • Logical Data, Illogical Assignment
          • Random Class
        • Conditional Statements >
          • Number validator
          • Number tester
          • Speed Camera
        • Loops >
          • For Loops >
            • Adding Numbers
          • For Each Loops
          • While Loops
          • Do While Loops
        • Arrays >
          • Simple Arrays
          • Complex Arrays
      • Intro to Unity >
        • Unity Essentials >
          • Unity's Interface
          • The Essentials
          • Programming >
            • Getting Started with Scripting
            • Default Scripting
            • Scripting a Game Object
        • Intro to Programming 1 >
          • Player Control 1 >
            • Player Control 1.2
            • Player Control 1.3
            • Player Control 1.4
          • Player Control 2 >
            • Player Control 2.2
            • Player Control 2.3
            • Player Control 2.4
          • Player Control Challenge
        • Intro to Programming 2 >
          • Sound and Effects >
            • Sound and Effects 3.2
            • Sound and Effects 3.3
            • Sound and Effects 3.4
          • GamePlay
          • User Interface
          • Feedback and Testing
          • Next Steps
        • Intro to Programming 3 >
          • Manage Scene Flow and Data
          • Apply Object-Oriented Principles
    • Modeling and Rigging >
      • Modeling >
        • Introduction: The Temple
        • Name Text Curve
        • Character Modeling >
          • Minecraft Steve
          • Minecraft Steve UV
          • Roblox Character modeling
          • Big Daddy
          • Character Modeling Legion the Geth
          • Character Modeling Geth Armor
        • Weapons >
          • Minecraft Tools and Weapons
          • Minecraft Movie Pickaxe
          • Minecraft Movie Sword
          • Thor's Hammer
          • Hammer
          • LOL Sword
          • Sword of Light
          • Buzz Axe
          • Weapon
      • Rigging >
        • Intro to Rigging
        • Controls
        • Rigging Basics
        • Rigging Creating Skeletons
        • Rigging: Body Controls
        • Rigging: Hands
        • Rigging: Skinning
        • Smooth Skinning
      • Animation >
        • Walk-Cycle 1
        • Walk-Cycle 2
    • Advanced >
      • Modeling >
        • Image Planes
        • Polygon Modeling >
          • Coke Can
          • Low Polygon Character
          • Character Modeling Legion the Geth
          • Character Modeling Geth Armor
          • Face Modeling
        • NURBS Modeling >
          • Intro to NURBS
          • Lofting
          • CV Curves
          • Organic Modeling
          • Autombile
      • Linda Training >
        • Advanced Modeling >
          • Modeling Basics
          • Modeling Room Objects
      • Texturing
      • Rigging >
        • Rigging with HumanIK
        • Smooth Skinning
  • Student Films
    • Advanced Student's movies
    • Beginning Student's movies
  • Links
    • BPA >
      • BPA Computer Modeling
    • The Top Six Animation Schools
    • The Top Video Game Design Schools

Lesson 3.1 - Sound and Effects


​Open prototype & change background

  1. Open Unity Hub and create an empty “Prototype 3” project in your course directory on the correct Unity version. If you forget how to do this, refer to the instructions in Lesson 1.1 - Step 1
  2. Click to download the Prototype 3 Starter Files, extract the compressed folder, and then import the .unitypackage into your project. If you forget how to do this, refer to the instructions in Lesson 1.1 - Step 2
  3. Open the Prototype 3 scene and delete the Sample Scene without saving
  4. Select the Background object in the hierarchy, then in the Sprite Renderer component > Sprite, select the _City, _Nature, or _Town image

Choose and set up a player character

  1. From Course Library > Characters, Drag a character into the hierarchy, rename it “Player”, then rotate it on the Y axis to face to the right
  2. Add a Rigid Body component
  3. Add a box collider, then edit the collider bounds
  4. Create a new “Scripts” folder in Assets, create a “PlayerController” script inside, and attach it to the player

​Make player jump at start

  1. In PlayerController.cs, declare a new private Rigidbody playerRb; variable
  2. In Start(), initialize playerRb = GetComponent<Rigidbody>();
  3. In Start(), use the AddForce method to make the player jump at the start of the game
Picture

​Make player jump if spacebar pressed

​
  1. In Update() add an if-then statement checking if the spacebar is pressed
  2. Cut and paste the AddForce code from Start() into the if-statement
  3. Add the ForceMode.Impulse parameter to the AddForce call, then reduce force multiplier value
Picture

Tweak the jump force and gravity

  1. Replace the hardcoded value with a new public float jumpForce variable
  2. Add a new public float gravityModifier variable and in Start(), add Physics.gravity *= gravityModifier;
  3. In the inspector, tweak the gravityModifier, jumpForce, and Rigibody mass values to make it fun
Picture

​Prevent player from double-jumping

  1. Add a new public bool isOnGround variable and set it equal to true
  2. In the if-statement making the player jump, set isOnGround = false, then test
  3. Add a condition && isOnGround to the if-statement
  4. Add a new void OnCollisionEnter method, set isOnGround = true in that method, then test
Picture

​Make an obstacle and move it left

  1. From Course Library > Obstacles, add an obstacle, rename it “Obstacle”, and position it where it should spawn
  2. Apply a Rigid Body and Box Collider component, then edit the collider bounds to fit the obstacle
  3. Create a new “Prefabs” folder and drag it in to create a new Original Prefab
  4. Create a new “MoveLeft” script, apply it to the obstacle, and open it
  5. In MoveLeft.cs, write the code to Translate it to the left according to the speed variable
  6. Apply the MoveLeft script to the Background
Picture

​Create a spawn manager

  1. Create a new “Spawn Manager” empty object, then apply a new SpawnManager.cs script to it
  2. In SpawnManager.cs, declare a new public GameObject obstaclePrefab;, then assign your prefab to the new variable in the inspector
  3. Declare a new private Vector3 spawnPos at your spawn location
  4. In Start(), Instantiate a new obstacle prefab, then delete your prefab from the scene and test
Picture

​Spawn obstacles at intervals

  1. Create a new void SpawnObstacle method, then move the Instantiate call inside it
  2. Create new float variables for startDelay and repeatRate
  3. Have your obstacles spawn on intervals using the InvokeRepeating() method
  4. In the Player Rigid Body component, expand Constraints, then Freeze all but the Y position
Picture
Onto the next page
Proudly powered by Weebly