Download presentation
Presentation is loading. Please wait.
1
Women in Game Programming
Professor Ira Fay Class 3
2
Overview Mining Part 2 Programming Concepts Rachelle Davis Unity Demo
3
Learn a Name Stand up Learn the name of someone you don’t know
Sit down
4
Mining – Part 2 How did it go? Walkthroughs? GitHub?
5
Mining – Part 2 Creating a GameObject and attaching a script Time.time
Update() loop
6
Growth Mindset Reminder
With a growth mindset, we can improve our skills through practicing. Learning happens over time, not instantly. The process of learning is uncomfortable when we’re not competent yet.
7
Math vs. Programming Math and programming look similar, but aren’t the same
8
Programming Lines of code are executed in order
= is an assignment operator Programming is typo-intolerant You have to say the magic words exactly right for the spell to work!
9
Variables Variables hold information
Variables can change value while the program is executing Example int myRoll;
10
Methods Methods are like a factory: Example
They take input, and spit out results Example Random.Range(1,7);
11
Three Useful commands += // if ()
12
Useful commands: += totalScore = 0; myRoll = Random.Range(1, 7); totalScore = totalScore + myRoll;
13
Useful commands: += totalScore = 0; myRoll = Random.Range(1, 7); totalScore += myRoll;
14
Useful commands: // // Player starts with a score of 0 totalScore = 0; // Roll 1d6 myRoll = Random.Range(1, 7); // Add the roll to the score totalScore += myRoll; That’s what comments look like. Not executed by the computer. Mostly a note to your future self, and other programmers.
15
Useful commands: // totalScore = 0; // Random.Range excludes the max number when // given ints, so this returns a number 1-6 myRoll = Random.Range(1, 7); totalScore += myRoll; Ideally, your code should be self-documenting. Pick variable names and method names that are clear, so you don’t need comments. totalScore = 0 is obvious. Add comments where there’s a tricky bit of code that’s not as obvious.
16
Useful commands: if() totalScore = 0; // Random.Range excludes the max # for ints myRoll = Random.Range(1, 7); if (myRoll > 4) { totalScore += myRoll; } Indent anything within the if() statement. Don’t forget the starting and ending {}. When typing it, put the { } in the code, then fill in the middle.
17
Useful commands: if() > means greater than < means less than >= means greater than or equal to <= means less than or equal to == means equal != means not equal && means AND || means OR Remember that = is an assignment operator!
18
Variables Variables hold information
Variables can change value while the program is executing
19
Unity Demo Create an empty game object, rename it Add a script to it
Print Time.time Do something at 3 seconds. Change 3 seconds to a variable name. ActionTimer Do something every 3 seconds. How? Create a second variable. TimeToAct Create a BronzeCube prefab. Organize my files.
20
Rachelle Davis 1:45pm Now! Come prepared with 1 question
Skype rachelle.m.davis
21
Josie Nutter Wednesday! Come prepared with 1 question
Google Hangout:
22
Game Jam! Who went? How was it?
23
Useful commands: for()
How could I display the numbers 1 to 9?
24
Useful commands: for()
How could I display the numbers 1 to 9? print (“1”); print (“2”); print (“3”); print (“4”); print (“5”); print (“6”); print (“7”); print (“8”); print (“9”);
25
Useful commands: for()
How could I display the numbers 1 to 99? 1 to 999?
26
Useful commands: for()
// Count from 1 to 9 for (int i = 1; i < 10; i += 1) { print (i); } // We could also use a while() loop int i = 1; while (i < 10) { i += 1;
27
Useful commands: for()
// Count from 1 to 99 for (int i = 1; i < 100; i += 1) { print (i); } // We could also use a while() loop int i = 1; while (i < 100) { i += 1;
28
Useful commands: for()
// Count from 1 to 999 for (int i = 1; i < 1000; i += 1) { print (i); } // We could also use a while() loop int i = 1; while (i < 1000) { i += 1;
29
Crafting Life Isaiah + team made a game over the summer!
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.