Class hours: 10:05 – 2:45
Mr. Bohmann | wbohmann@ewsd.org
10:05 Today’s Notes & Attendance
Today is a Wacky Wednesday
Call Backs:
SkillsUSA State Competition is schedule for Tuesday, April 8th
SkillsUSA Award Luncheon is schedule for Friday, April 11th – we will attend
The awards lunch has a dress code – Please take a quick survey to see if you have the correct clothing. If you don’t have the required clothes, I will work with you to secure the correct attire. Do not go out and buy anything!
Permission Slips – I need these back as soon as you possible can. These are for the SkillsUSA Award Lunch.

Unity: Create a new 2D project this morning. Name it: 2D_Playground Please do this before 11am this morning.
10:10 Vermont Highway Safety Alliance – Workshop

As of this moment you should know what kind of distracted driving you are featuring in your PSA. Your PSA will include some facts / figures from Vermont and/or Nationally. Let’s take a little time this morning getting our data sorted.
The information you find will be recorded on this Distracted Driving Facts Sheet. Complete by 10:50am today.
These resources will assist you with finding your facts and data.
Here is a student sample that did a great job incorporating information into their PSA. Here is another good use of facts. Here is one with facts shared during the PSA.
What each of these PSAs have in common is there is enough time to read the facts!
10:50 Break

11:00 Animation Showcase
Bendy Bones & 2D Walking Animations – let’s take a look and see how your animations turned out.
11:15 Unity

Programming can be fun. Practice will help you make connections to coding with C#.
This morning, let’s look at moving, rotating and scaling game objects using c# scripting.
Download, Unzip and add this folder into your project. We’ll use some of these sprites for practice.
Transform Component
You were introduced to the Transform component in earlier work we have done. Every GameObject has a default Transform component that can control the sprite’s position (X and Y coordinates), rotation (angle), and scale (size). Since the Transform component is required, you cannot remove it from a GameObject or create a GameObject without this component.
In a 2D game, rotation happens on the Z axis.
Calling Functions
A function is a pre-written block of code that belongs to some object. You call or run a function to perform a task. We’ve written many functions so far.
To call a function, you need to start by writing the name of the object that owns the function. Then add a dot (.) and the name of the function you want to call. After the function name comes opening and closing parentheses ( and ), followed by a semicolon. If you need to pass data values into the function, those parameters are placed inside the parentheses, separated by commas. Unity has many built in functions as part of the Unity library.
object.function(parameter 1, parameter2, ...);
Translate()function
To move a sprite, we want to call the Translate() function on the transform object.
The Translate() function requires three parameters – values for the change in X, the change in Y, and the change in the Z properties.
transform.Translate(xchange, ychange, zchange);
The Update() function within the game loop is a great place to update the sprite’s position.
We can use Time.deltaTime as part of the input to the Translate() method, so game objects move at a consistent speed on most computers. This will make your GameObject move smoother.
In the simplest terms, Time.deltaTime is:
- The time it took to complete the last frame.
- This lets you make things move at the same speed, no matter how fast or slow the computer is running the game.
- Essentially, your game’s movement and timing will be consistent across different computers.

void Update()
{
transform.Translate(Time.deltaTime, 0.0f, 0.0f);
}
Rotation
The angle of an object’s rotation (or spin) is measured in degrees. By default, an object has 0 degrees of rotation. You can spin counterclockwise by using positive degree values between 0 and 360.

If you use a negative rotation value, then the object will spin clockwise instead.
Normally in a 2D game, you’ll just want to rotate around the “Z” axis.
If we want to rotate our spaceship object counter-clockwise on the screen. We can do this by calling the Rotate() function on the transform component.
transform.Rotate(xchange, ychange, zchange);
I we are using Time.deltaTime, it will cause our ship to rotate at a rate of 1 degree per second. Since there are 360 degrees in a circle, it will take 6 minutes to make a single full rotation!
If we multiply Time.deltaTime by 360 it will rotate our ship a full turn each second
Scale
The third set of properties in the Transform component is the Scale settings. These
settings will make a sprite grow or shrink on the screen.
Unfortunately, the Transform component does not have a handy function like Translate() or Rotate() to change the scale values. Instead, we need to manually add new values to the existing scale settings.
transform.localScale += new Vector3(xchange, ychange, zchange);
So to make this easier we will use the “+=” characters, which means take the value following on the right side and add it into the property on the left side.
11:55 Lunch

12:25 Independent Reading

12:50 Break

1:00 Production Time and Guided Support
1:50 Dailies

Dailies can be placed in the CAWD2 Dailies Folder on the CAWD2 Public Folders drive