[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:01.74,0:00:03.81,Default,,0000,0000,0000,,So, we already made\Nthis super cool variable Dialogue: 0,0:00:03.81,0:00:06.48,Default,,0000,0000,0000,,for Winston's eye size,\Nwhich has been really helpful Dialogue: 0,0:00:06.48,0:00:08.92,Default,,0000,0000,0000,,because it saves us a lot of typing\Nwhen we want to change Dialogue: 0,0:00:08.92,0:00:10.50,Default,,0000,0000,0000,,the size of Winston's eyes. Dialogue: 0,0:00:10.50,0:00:13.39,Default,,0000,0000,0000,,Remember: before, we had to\Ntype the same number {\i1}four times{\i0} Dialogue: 0,0:00:13.39,0:00:15.97,Default,,0000,0000,0000,,whenever we wanted\Nto change the size of his eyes. Dialogue: 0,0:00:15.97,0:00:17.81,Default,,0000,0000,0000,,But, can we use variables\Nto replace numbers Dialogue: 0,0:00:17.81,0:00:19.21,Default,,0000,0000,0000,,when they're not all the same? Dialogue: 0,0:00:19.21,0:00:21.72,Default,,0000,0000,0000,,Like, what if I wanted to\Nmove Winston over a little bit? Dialogue: 0,0:00:21.72,0:00:23.76,Default,,0000,0000,0000,,I could change\Neach of these {\i1}x{\i0} coordinates, Dialogue: 0,0:00:23.76,0:00:25.57,Default,,0000,0000,0000,,but they're not all the same anyways, Dialogue: 0,0:00:25.57,0:00:27.93,Default,,0000,0000,0000,,so I can't just replace them all\Nwith some variable. Dialogue: 0,0:00:27.93,0:00:29.14,Default,,0000,0000,0000,,{\i1}But wait!{\i0} Dialogue: 0,0:00:29.14,0:00:31.82,Default,,0000,0000,0000,,Once I assign a number to a variable,\NI can use that variable Dialogue: 0,0:00:31.82,0:00:33.94,Default,,0000,0000,0000,,exactly as if it were that number, Dialogue: 0,0:00:33.94,0:00:37.07,Default,,0000,0000,0000,,which means I can use variables\Nand math expressions. Dialogue: 0,0:00:37.07,0:00:39.06,Default,,0000,0000,0000,,So, how about this:\Nlet's make a variable Dialogue: 0,0:00:39.06,0:00:41.04,Default,,0000,0000,0000,,for the {\i1}x{\i0} position of Winston. Dialogue: 0,0:00:41.04,0:00:43.02,Default,,0000,0000,0000,,Call it {\i1}var x{\i0}. Dialogue: 0,0:00:43.02,0:00:45.48,Default,,0000,0000,0000,,Simple enough.\NOkay, now let's give it Dialogue: 0,0:00:45.48,0:00:48.04,Default,,0000,0000,0000,,the value of the {\i1}x{\i0} coordinate\Nof Winston's face. Dialogue: 0,0:00:48.04,0:00:51.34,Default,,0000,0000,0000,,His face is being drawn\Nat {\i1}x{\i0} coordinate 200. Dialogue: 0,0:00:51.34,0:00:54.42,Default,,0000,0000,0000,,So, we're going to say {\i1}var x{\i0} gets {\i1}200{\i0}. Dialogue: 0,0:00:55.05,0:00:59.02,Default,,0000,0000,0000,,Now I can replace this number\Nwith my new variable {\i1}x{\i0}, Dialogue: 0,0:00:59.02,0:01:02.48,Default,,0000,0000,0000,,and when I change the value of {\i1}x{\i0},\Nit moves Winston's face, Dialogue: 0,0:01:02.48,0:01:04.29,Default,,0000,0000,0000,,but not his eyes or his mouth. Dialogue: 0,0:01:04.98,0:01:08.04,Default,,0000,0000,0000,,So, to fix that, we're going to define Dialogue: 0,0:01:08.04,0:01:10.42,Default,,0000,0000,0000,,the position of his eyes and his mouth, Dialogue: 0,0:01:10.42,0:01:14.08,Default,,0000,0000,0000,,relative to the position of his face. Dialogue: 0,0:01:14.08,0:01:16.75,Default,,0000,0000,0000,,The {\i1}x{\i0} coordinates\Nare going to be the centers Dialogue: 0,0:01:16.75,0:01:20.46,Default,,0000,0000,0000,,of all the other ellipses,\Nso his face is being drawn at-- Dialogue: 0,0:01:20.46,0:01:24.60,Default,,0000,0000,0000,,that's 200,\Nand let's do his left eye first. Dialogue: 0,0:01:24.60,0:01:26.47,Default,,0000,0000,0000,,So, this ellipse is his left eye,\Nand we can see Dialogue: 0,0:01:26.47,0:01:29.61,Default,,0000,0000,0000,,that it's being drawn at 150. Dialogue: 0,0:01:29.61,0:01:33.08,Default,,0000,0000,0000,,Right here, that is 150, Dialogue: 0,0:01:33.08,0:01:37.55,Default,,0000,0000,0000,,and I know that 150 is 50 less than 200. Dialogue: 0,0:01:37.55,0:01:42.36,Default,,0000,0000,0000,,So, his left eye should be\Nwherever his face is, minus 50. Dialogue: 0,0:01:42.36,0:01:47.66,Default,,0000,0000,0000,,It's going to be {\i1}x{\i0},\Nwhich is the position of his face, {\i1}- 50{\i0}. Dialogue: 0,0:01:48.02,0:01:50.08,Default,,0000,0000,0000,,And now, if I change the value\Nof this {\i1}x{\i0} coordinate, Dialogue: 0,0:01:50.08,0:01:53.25,Default,,0000,0000,0000,,his eye moves along with his face. Dialogue: 0,0:01:53.25,0:01:54.62,Default,,0000,0000,0000,,Let's do the other ones. Dialogue: 0,0:01:54.62,0:01:57.50,Default,,0000,0000,0000,,So, his right eye is being drawn at 300, Dialogue: 0,0:01:57.50,0:02:01.47,Default,,0000,0000,0000,,I can see, so this over here is 300. Dialogue: 0,0:02:01.47,0:02:05.75,Default,,0000,0000,0000,,And 300, I know, is 100 more than 200. Dialogue: 0,0:02:05.75,0:02:09.90,Default,,0000,0000,0000,,So, his right eye should be\Nwherever his face is plus 100. Dialogue: 0,0:02:09.90,0:02:12.54,Default,,0000,0000,0000,,That's {\i1}x + 100{\i0}. Dialogue: 0,0:02:12.54,0:02:14.18,Default,,0000,0000,0000,,And now we just have his mouth. Dialogue: 0,0:02:14.18,0:02:16.86,Default,,0000,0000,0000,,His mouth is being drawn at 250. Dialogue: 0,0:02:16.86,0:02:19.40,Default,,0000,0000,0000,,That's over here, we've got 250, Dialogue: 0,0:02:19.40,0:02:22.90,Default,,0000,0000,0000,,and 250 is 200 plus 50. Dialogue: 0,0:02:22.90,0:02:26.05,Default,,0000,0000,0000,,So, it's going to be wherever--\Nooh, that's a 5-- Dialogue: 0,0:02:26.05,0:02:30.98,Default,,0000,0000,0000,,wherever his face is,\N{\i1}x + 50{\i0}. Dialogue: 0,0:02:30.98,0:02:33.35,Default,,0000,0000,0000,,And now--\NI'm going to get rid of these scribbles-- Dialogue: 0,0:02:33.35,0:02:38.25,Default,,0000,0000,0000,,whenever I change the value of {\i1}x{\i0},\Nit moves his whole face. Dialogue: 0,0:02:38.25,0:02:39.58,Default,,0000,0000,0000,,Yay! Dialogue: 0,0:02:39.58,0:02:42.79,Default,,0000,0000,0000,,Now before you go, you should know\Na couple more things about variables. Dialogue: 0,0:02:42.79,0:02:45.56,Default,,0000,0000,0000,,Once you create a variable using {\i1}var x{\i0}, Dialogue: 0,0:02:45.56,0:02:48.40,Default,,0000,0000,0000,,you can assign a value to it\Nas many times as you want. Dialogue: 0,0:02:48.40,0:02:51.50,Default,,0000,0000,0000,,So, after giving {\i1}x{\i0} the value of 198, Dialogue: 0,0:02:51.50,0:02:54.95,Default,,0000,0000,0000,,I could say {\i1}x{\i0} gets {\i1}300{\i0}, Dialogue: 0,0:02:54.95,0:02:59.24,Default,,0000,0000,0000,,or {\i1}x{\i0} gets {\i1}150{\i0}. Dialogue: 0,0:02:59.24,0:03:01.22,Default,,0000,0000,0000,,And from then on,\Nthe computer would treat {\i1}x{\i0} Dialogue: 0,0:03:01.22,0:03:03.43,Default,,0000,0000,0000,,as if it were\Nwhatever we last assigned it. Dialogue: 0,0:03:03.43,0:03:05.42,Default,,0000,0000,0000,,So, in this case, 150. Dialogue: 0,0:03:05.42,0:03:08.24,Default,,0000,0000,0000,,But, you only need to type {\i1}var{\i0}\Nonce per variable. Dialogue: 0,0:03:08.24,0:03:12.51,Default,,0000,0000,0000,,If, over here, I had typed\N{\i1}var x{\i0} gets {\i1}150{\i0} instead, Dialogue: 0,0:03:12.51,0:03:15.82,Default,,0000,0000,0000,,that would have made\Na brand new variable named {\i1}x{\i0}, Dialogue: 0,0:03:15.82,0:03:18.39,Default,,0000,0000,0000,,completely destroying\Nthe old variable {\i1}x{\i0} in the process, Dialogue: 0,0:03:18.39,0:03:21.56,Default,,0000,0000,0000,,so all these variables\Nare gone, in the dumpster. Dialogue: 0,0:03:21.56,0:03:24.62,Default,,0000,0000,0000,,And then, afterwards, the computer\Nwould only use the new variable. Dialogue: 0,0:03:24.62,0:03:28.13,Default,,0000,0000,0000,,Sometimes you can do this kind of thing\Nwithout horrible things happening to you, Dialogue: 0,0:03:28.13,0:03:29.85,Default,,0000,0000,0000,,but I wouldn't advise it. Dialogue: 0,0:03:29.85,0:03:33.21,Default,,0000,0000,0000,,For now, I'm just going to do it once:\N{\i1}var x{\i0} gets {\i1}150{\i0}. Dialogue: 0,0:03:33.21,0:03:37.19,Default,,0000,0000,0000,,And now, conveniently,\NI can move all of Winston off the screen, Dialogue: 0,0:03:37.19,0:03:40.25,Default,,0000,0000,0000,,so I can talk about my next point. Dialogue: 0,0:03:40.25,0:03:44.59,Default,,0000,0000,0000,,Whenever you have\Na variable equals something, Dialogue: 0,0:03:44.59,0:03:47.45,Default,,0000,0000,0000,,that variable is in a happy, safe place. Dialogue: 0,0:03:47.45,0:03:50.69,Default,,0000,0000,0000,,In fact, to the left of the equal sign\Nis the only place Dialogue: 0,0:03:50.69,0:03:53.53,Default,,0000,0000,0000,,where a variable\Ncan truly feel like itself, Dialogue: 0,0:03:53.53,0:03:55.54,Default,,0000,0000,0000,,because that is the only place\Nwhere the computer Dialogue: 0,0:03:55.54,0:03:57.35,Default,,0000,0000,0000,,will consider it to be a variable. Dialogue: 0,0:03:57.35,0:04:00.04,Default,,0000,0000,0000,,Anywhere else, the computer\Njust pretends it's a value. Dialogue: 0,0:04:00.04,0:04:02.38,Default,,0000,0000,0000,,So even if we do something like this: Dialogue: 0,0:04:02.38,0:04:06.04,Default,,0000,0000,0000,,{\i1}var x{\i0} gets {\i1}10{\i0} Dialogue: 0,0:04:06.04,0:04:10.50,Default,,0000,0000,0000,,and then {\i1}x{\i0} gets {\i1}x{\i0}. Dialogue: 0,0:04:10.50,0:04:11.73,Default,,0000,0000,0000,,Woo, confusing. Dialogue: 0,0:04:11.73,0:04:14.57,Default,,0000,0000,0000,,Well, over on the left,\Nwe've got {\i1}x{\i0}, Dialogue: 0,0:04:14.57,0:04:17.50,Default,,0000,0000,0000,,which is a free-thinking,\Nindependent variable; Dialogue: 0,0:04:17.50,0:04:20.37,Default,,0000,0000,0000,,one that can {\i1}grow{\i0}, can {\i1}change!{\i0} Dialogue: 0,0:04:20.37,0:04:24.100,Default,,0000,0000,0000,,But, on the right, it's just,\Nwell it's just 10. Dialogue: 0,0:04:24.100,0:04:27.16,Default,,0000,0000,0000,,So sad!\NBut that means Dialogue: 0,0:04:27.16,0:04:28.94,Default,,0000,0000,0000,,we can do really useful stuff like this: Dialogue: 0,0:04:28.94,0:04:33.54,Default,,0000,0000,0000,,I can say {\i1}x{\i0} gets {\i1}x + 1{\i0} Dialogue: 0,0:04:33.54,0:04:37.02,Default,,0000,0000,0000,,So, on the left, we've got our variable\Nin a happy, safe place, Dialogue: 0,0:04:37.02,0:04:40.41,Default,,0000,0000,0000,,and on the right, we have this variable, Dialogue: 0,0:04:40.41,0:04:42.67,Default,,0000,0000,0000,,which we know is basically just a number, Dialogue: 0,0:04:42.67,0:04:44.21,Default,,0000,0000,0000,,so it's just 10. Dialogue: 0,0:04:44.21,0:04:47.20,Default,,0000,0000,0000,,So, we can mentally replace\Nthis with {\i1}x{\i0} gets 10 plus 1, Dialogue: 0,0:04:47.20,0:04:51.06,Default,,0000,0000,0000,,Which just means {\i1}x{\i0} gets {\i1}11{\i0}. Dialogue: 0,0:04:51.06,0:04:54.32,Default,,0000,0000,0000,,So, this whole line is basically\Njust saying {\i1}x{\i0} gets {\i1}11{\i0}, Dialogue: 0,0:04:54.32,0:04:57.57,Default,,0000,0000,0000,,so from now on the value of {\i1}x{\i0} is 11. Dialogue: 0,0:04:57.57,0:05:01.20,Default,,0000,0000,0000,,Let's see what happens if we\Nbring another variable into the equation. Dialogue: 0,0:05:01.20,0:05:06.45,Default,,0000,0000,0000,,I'm going to do {\i1}var x{\i0} gets {\i1}10{\i0}, Dialogue: 0,0:05:06.45,0:05:10.47,Default,,0000,0000,0000,,{\i1}var y{\i0} gets {\i1}20{\i0}, Dialogue: 0,0:05:10.47,0:05:12.15,Default,,0000,0000,0000,,{\i1}x{\i0} gets {\i1}y{\i0} -- Dialogue: 0,0:05:12.15,0:05:13.84,Default,,0000,0000,0000,,oh, my god-- Dialogue: 0,0:05:13.84,0:05:17.11,Default,,0000,0000,0000,,and {\i1}y{\i0} gets {\i1}7{\i0}. Dialogue: 0,0:05:17.11,0:05:18.71,Default,,0000,0000,0000,,Okay, and what I want to know is, Dialogue: 0,0:05:18.71,0:05:22.10,Default,,0000,0000,0000,,what is the value of {\i1}x{\i0}? Dialogue: 0,0:05:22.10,0:05:23.53,Default,,0000,0000,0000,,Let's figure this out. Dialogue: 0,0:05:23.53,0:05:27.18,Default,,0000,0000,0000,,So, at this line here,\Nwe're making a new variable {\i1}x{\i0}, Dialogue: 0,0:05:27.18,0:05:29.17,Default,,0000,0000,0000,,and assigning it the value of 10. Dialogue: 0,0:05:29.17,0:05:31.78,Default,,0000,0000,0000,,So the value of {\i1}x{\i0} is 10. Dialogue: 0,0:05:31.78,0:05:33.80,Default,,0000,0000,0000,,At this line, we're making\Na new variable {\i1}y{\i0}, Dialogue: 0,0:05:33.80,0:05:35.75,Default,,0000,0000,0000,,and giving it the value of 20. Dialogue: 0,0:05:35.75,0:05:37.04,Default,,0000,0000,0000,,We don't do anything to {\i1}x{\i0}, Dialogue: 0,0:05:37.04,0:05:39.34,Default,,0000,0000,0000,,so the value of {\i1}x{\i0} is still 10. Dialogue: 0,0:05:39.34,0:05:41.99,Default,,0000,0000,0000,,Over here, we're saying {\i1}x{\i0} gets {\i1}y{\i0}. Dialogue: 0,0:05:41.99,0:05:44.41,Default,,0000,0000,0000,,Well, that's pretty confusing,\Nbut if you think about it, Dialogue: 0,0:05:44.41,0:05:46.21,Default,,0000,0000,0000,,we know that only one of these variables Dialogue: 0,0:05:46.21,0:05:48.45,Default,,0000,0000,0000,,is in the happy, safe place, Dialogue: 0,0:05:48.45,0:05:50.38,Default,,0000,0000,0000,,and the other variable is being treated Dialogue: 0,0:05:50.38,0:05:53.75,Default,,0000,0000,0000,,exactly as if it were a number. Dialogue: 0,0:05:53.75,0:05:55.69,Default,,0000,0000,0000,,So over here, we can mentally replace Dialogue: 0,0:05:55.69,0:05:57.79,Default,,0000,0000,0000,,this {\i1}y{\i0} with its value, which is 20, Dialogue: 0,0:05:57.79,0:06:01.76,Default,,0000,0000,0000,,and we know that what this line\Nreally means is {\i1}x{\i0} gets {\i1}20{\i0}. Dialogue: 0,0:06:01.77,0:06:05.03,Default,,0000,0000,0000,,So, the value of {\i1}x{\i0} here is 20. Dialogue: 0,0:06:05.03,0:06:08.82,Default,,0000,0000,0000,,And then, over here, we've got {\i1}y{\i0}\Nin the happy safe place this time, Dialogue: 0,0:06:08.82,0:06:10.42,Default,,0000,0000,0000,,but it's not really that confusing, Dialogue: 0,0:06:10.42,0:06:12.70,Default,,0000,0000,0000,,because we've just got a number\Non the other side. Dialogue: 0,0:06:12.70,0:06:17.42,Default,,0000,0000,0000,,So, here's the big question:\Nwhen I change the value of {\i1}y{\i0} here, Dialogue: 0,0:06:17.42,0:06:20.78,Default,,0000,0000,0000,,does that change the value of {\i1}x{\i0} up here? Dialogue: 0,0:06:20.78,0:06:26.05,Default,,0000,0000,0000,,And the answer:\N{\i1}No! No, no, no, no, no!{\i0} Dialogue: 0,0:06:26.05,0:06:28.78,Default,,0000,0000,0000,,You've got to remember, up here, Dialogue: 0,0:06:28.78,0:06:31.76,Default,,0000,0000,0000,,{\i1}y{\i0} is just being treated like a number. Dialogue: 0,0:06:31.76,0:06:34.62,Default,,0000,0000,0000,,The computer's going to completely ignore\Nthat it's a variable, Dialogue: 0,0:06:34.62,0:06:36.27,Default,,0000,0000,0000,,forget the fact that it can change, Dialogue: 0,0:06:36.27,0:06:38.77,Default,,0000,0000,0000,,and it's just going to say, Dialogue: 0,0:06:38.77,0:06:42.38,Default,,0000,0000,0000,,"Oh, {\i1}y{\i0}? What you really mean is 20." Dialogue: 0,0:06:42.38,0:06:44.74,Default,,0000,0000,0000,,So right here,\Nwe're just assigning a number to {\i1}x{\i0}, Dialogue: 0,0:06:44.74,0:06:46.62,Default,,0000,0000,0000,,we're not assigning a variable. Dialogue: 0,0:06:46.62,0:06:50.25,Default,,0000,0000,0000,,We're assigning the value of {\i1}y{\i0},\Nwhich is 20, Dialogue: 0,0:06:50.25,0:06:54.03,Default,,0000,0000,0000,,and that means that\Nthe value of {\i1}x{\i0} stays 20, Dialogue: 0,0:06:54.03,0:06:58.37,Default,,0000,0000,0000,,even after we change the value\Nof this {\i1}y{\i0} variable from the last line. Dialogue: 0,0:06:59.93,0:07:01.67,Default,,0000,0000,0000,,Phew! {\i1}Capisce{\i0}? Dialogue: 0,0:07:01.67,0:07:05.23,Default,,0000,0000,0000,,Well, now you guys are\Ntotal experts on variables. Dialogue: 0,0:07:05.23,0:07:07.30,Default,,0000,0000,0000,,Congratulations!