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 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
        • 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
          • Demon School Iruma-kun
          • 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
    • 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
    • The Top Six Animation Schools
    • The Top Video Game Design Schools

Casting

     In this lesson we are going to try and familiarize ourselves with a new idea in programming... We are going to push a piece of data from one type of variable into another. In many cases this can be handled easily. In some cases this is much more complicated. 

     To cast a piece of data from a smaller variable to a larger is easily accomplished. For example moving data from a byte to an int is simple. A byte is a small variable that can store numbers between -255 to 255. An int is a much larger variable and can store numbers from 
-4294967296 to 4294967295. So moving a number from a byte (small) to an int (larger) is relatively simple. The move from an int (large) to a byte (small) is much more difficult and many times occurs in data loss. 

     To move data from a large variable to a small requires a method called casting. Casting is basically a method of forcing the computer to overwrite its built in measures of not allowing this switch to happen. Normally it will throw an exception error because it usually involves data loss to accomplish this move. 

     This process is further complicated if we are trying to convert a string (meant for characters and words) into an int. If the data stored in the string is actually a number... We will need to convert it before we can cast it into the int.
     
​     Boy that was fun to type out... Am i speaking a foreign language? it feels like i am speaking a foreign language!!!​



     If we send that same data to a byte (smaller) it makes things even more interesting...

Videos

The Assignment

Here is your assignment

1. Have a greeting printed to the screen
2. Create a string named s and assign the value of 25 into it
3. Print
 a message saying something like "we have a string variable with " +s "in it" 
4. Convert this string s into a variable type int named i
5. Print int i out to the console screen with a message saying something like "we converted the data to an int and it is still" +i
6. Convert int i to a byte named b
7. Print byte b out to the console with a message saying something like "
we converted the data to a byte and it is still" +b
Proudly powered by Weebly