Professor Ira Fay Class 4
Mining Part 3 Programming Concepts Josie Nutter Unity Demo
Stand up Learn the name of someone you don’t know Sit down
How is it going? Are you using the walkthroughs? GitHub?
Creating a GameObject and attaching a script Time.time Update() loop
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.
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!
Variables hold information Variables can change value while the program is executing Example int myRoll;
Methods are like a factory: They take input, and spit out results Example Random.Range(1,7);
+= // if ()
++ enum
// add 1 to i i = i + 1; // add 1 to i i += 1; // add 1 to i i++;
How do we track where we are in the game? // 0 is Bronze // 1 is Silver // 2 is Done int gameState = 0;
How do we track where we are in the game? // 0 is Bronze // 1 is Silver // 2 is Done int gameState = 0; if (gameState == 0) { SpawnBronze(); }
How do we track where we are in the game? public enum GameState { Bronze, Silver, Done }
How do we track where we are in the game? GameState myState = GameState.Bronze; if (myState == GameState.Bronze) { SpawnBronze(); }
Now! Come prepared with 1 question
Monday! Come prepared with 1 question
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”);
How could I display the numbers 1 to 99? 1 to 999?
// 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) { print (i); i += 1; }
// 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) { print (i); i += 1; }
// 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) { print (i); i += 1; }
Isaiah + team made a game over the summer!