[Script Info] Title: [Events] Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text Dialogue: 0,0:00:01.30,0:00:03.68,Default,,0000,0000,0000,,Remember the three steps \Nof making an animation? Dialogue: 0,0:00:03.68,0:00:06.59,Default,,0000,0000,0000,,We start out by making some variables\Noutside the draw loop, Dialogue: 0,0:00:06.59,0:00:08.40,Default,,0000,0000,0000,,and then inside the draw loop\Nwe use those variables Dialogue: 0,0:00:08.40,0:00:10.01,Default,,0000,0000,0000,,in our drawing code. Dialogue: 0,0:00:10.01,0:00:12.04,Default,,0000,0000,0000,,So we've got a variable \Nfor the {\i1}x{\i0} position, Dialogue: 0,0:00:12.04,0:00:14.40,Default,,0000,0000,0000,,one for the {\i1}y{\i0} position, \None for the ballWidth, Dialogue: 0,0:00:14.40,0:00:16.01,Default,,0000,0000,0000,,and one for the ballHeight. Dialogue: 0,0:00:16.01,0:00:17.72,Default,,0000,0000,0000,,And then, at the very end, Dialogue: 0,0:00:17.72,0:00:20.02,Default,,0000,0000,0000,,we change those variables \Na little bit every time, Dialogue: 0,0:00:20.02,0:00:22.77,Default,,0000,0000,0000,,so {\i1}x{\i0} is going to be \Nthe old value of {\i1}x{\i0}, plus 1, Dialogue: 0,0:00:22.77,0:00:24.70,Default,,0000,0000,0000,,so it's going to be increasing every time; Dialogue: 0,0:00:24.70,0:00:27.80,Default,,0000,0000,0000,,{\i1}y{\i0} is going be the old value of {\i1}y{\i0}, minus 2, Dialogue: 0,0:00:27.80,0:00:29.80,Default,,0000,0000,0000,,so {\i1}y{\i0} will be decreasing every time; Dialogue: 0,0:00:29.80,0:00:35.41,Default,,0000,0000,0000,,ballWidth is going to get the old value\Nof ballWidth times 0.99. Dialogue: 0,0:00:35.41,0:00:39.41,Default,,0000,0000,0000,,So since 0.99 is less than 1, \Nwe're going to see ballWidth decreasing. Dialogue: 0,0:00:39.41,0:00:41.84,Default,,0000,0000,0000,,And ballHeight is going to be\Nthe old value of ballHeight Dialogue: 0,0:00:41.84,0:00:45.50,Default,,0000,0000,0000,,divided by 1.01, which is greater than 1, Dialogue: 0,0:00:45.50,0:00:47.96,Default,,0000,0000,0000,,and so we're also going to see \NballHeight decreasing. Dialogue: 0,0:00:47.96,0:00:50.23,Default,,0000,0000,0000,,So if I press {\i1}Restart{\i0}, you can see Dialogue: 0,0:00:50.23,0:00:53.58,Default,,0000,0000,0000,,all of these attributes \Nof the ball changing. Dialogue: 0,0:00:53.72,0:00:56.61,Default,,0000,0000,0000,,So if you look at \Nthese four lines of code, Dialogue: 0,0:00:56.61,0:00:59.25,Default,,0000,0000,0000,,you'll notice that \Nthey all follow a similar pattern. Dialogue: 0,0:00:59.25,0:01:01.40,Default,,0000,0000,0000,,We've got a variable, \Nthen an equals sign, Dialogue: 0,0:01:01.40,0:01:06.05,Default,,0000,0000,0000,,then the same variable, some operator --\Nplus, minus, times, divide -- Dialogue: 0,0:01:06.53,0:01:08.59,Default,,0000,0000,0000,,and some number, okay? Dialogue: 0,0:01:08.59,0:01:11.77,Default,,0000,0000,0000,,And this pattern is so common \Nin programming, Dialogue: 0,0:01:11.77,0:01:14.46,Default,,0000,0000,0000,,and programmers are so lazy,\Nthat they decided, Dialogue: 0,0:01:14.46,0:01:16.78,Default,,0000,0000,0000,,"Hey! Since we use this pattern so much, Dialogue: 0,0:01:16.78,0:01:19.05,Default,,0000,0000,0000,,"Shouldn't there be \Nan easier way to type it?" Dialogue: 0,0:01:19.05,0:01:22.01,Default,,0000,0000,0000,,And so they made a shortcut, \Nand the shortcut goes like this: Dialogue: 0,0:01:22.01,0:01:24.53,Default,,0000,0000,0000,,Instead of saying "x gets x plus 1", Dialogue: 0,0:01:24.53,0:01:29.33,Default,,0000,0000,0000,,I could say "x plus equals 1." Got it? Dialogue: 0,0:01:29.33,0:01:35.97,Default,,0000,0000,0000,,And instead of saying {\i1}y{\i0} gets {\i1}y{\i0} minus 2,\NI could say "y minus equals 2." Dialogue: 0,0:01:36.67,0:01:41.26,Default,,0000,0000,0000,,And instead of saying \NballWidth gets ballWidth times 0.99, Dialogue: 0,0:01:41.26,0:01:47.69,Default,,0000,0000,0000,,I can say -- you guessed it --\N{\i1}"ballWidth times equals 0.99"{\i0} Dialogue: 0,0:01:48.20,0:01:49.83,Default,,0000,0000,0000,,Finally, instead of saying Dialogue: 0,0:01:49.83,0:01:53.66,Default,,0000,0000,0000,,ballHeight gets ballHeight divided by 1.01 Dialogue: 0,0:01:53.66,0:01:57.37,Default,,0000,0000,0000,,we can say \N{\i1}"ballHeight divides equals 1.01."{\i0} Dialogue: 0,0:01:57.37,0:01:59.47,Default,,0000,0000,0000,,So for all of these, what it does is Dialogue: 0,0:01:59.47,0:02:01.55,Default,,0000,0000,0000,,it takes the value of the variables, Dialogue: 0,0:02:01.55,0:02:04.12,Default,,0000,0000,0000,,so ballWidth, and then this operator, Dialogue: 0,0:02:04.12,0:02:06.34,Default,,0000,0000,0000,,and then multiplies it by 0.99. Dialogue: 0,0:02:06.34,0:02:09.24,Default,,0000,0000,0000,,So it's going to say, \N{\i1}"ballWidth times 0.99"{\i0} Dialogue: 0,0:02:09.24,0:02:12.07,Default,,0000,0000,0000,,and then store it back \Nin the variable, ballWidth. Dialogue: 0,0:02:12.07,0:02:13.86,Default,,0000,0000,0000,,And if I press {\i1}Restart{\i0} you can see Dialogue: 0,0:02:13.86,0:02:16.00,Default,,0000,0000,0000,,our animation looks the same as before. Dialogue: 0,0:02:16.00,0:02:17.98,Default,,0000,0000,0000,,And now you get to be lazy too!