0:00:00.236,0:00:02.719 So we've been doing[br]a lot of drawing so far. 0:00:02.719,0:00:05.193 But we haven't talked about[br]something as simple as say, 0:00:05.193,0:00:07.595 writing your name;[br]that's what this lesson is about, text. 0:00:07.595,0:00:10.049 So why might you want to use text? 0:00:10.049,0:00:12.303 Well maybe we want to show [br]the score in a game 0:00:12.303,0:00:14.739 or have characters talk, [br]or just to make our name grow 0:00:14.739,0:00:16.305 and shrink and change colors. 0:00:16.305,0:00:18.654 So let's go ahead and try and say "hello."[br] 0:00:18.654,0:00:24.353 Say "text(hello)" and we have[br]this weird error message that pops up, 0:00:24.353,0:00:27.424 saying that "hello is not defined,"[br]what does that mean? 0:00:27.424,0:00:29.431 Well, the problem is that the program 0:00:29.431,0:00:31.058 thinks that "hello" is a variable, 0:00:31.058,0:00:33.715 and it kind of makes sense [br]from the program's perspective 0:00:33.715,0:00:36.222 because maybe "hello" could be a variable, [br]how would it know? 0:00:36.222,0:00:38.991 So how do we tell our program[br]that it's actually text? 0:00:38.991,0:00:41.350 So that's easy, we just have to remember 0:00:41.350,0:00:43.159 to put these quotations marks around it. 0:00:43.159,0:00:45.083 And that says [br]that no, this is not a variable, 0:00:45.083,0:00:46.457 and in fact this is text 0:00:46.457,0:00:48.153 or we want you to display it as text, 0:00:48.153,0:00:50.226 and you can remember this[br]by thinking of a book, 0:00:50.226,0:00:51.739 where all the characters talk, 0:00:51.739,0:00:53.694 and there are quotes[br]around what they are saying. 0:00:53.694,0:00:56.162 And similarly, when you want [br]the program to say something, 0:00:56.162,0:00:58.400 that text has to have [br]these qutoes around it. 0:00:58.400,0:01:00.899 And this is actually really important[br]and easy to mess up. 0:01:00.899,0:01:03.891 So i'm just going to say it again,[br]anytime you want to use text 0:01:03.891,0:01:05.753 in your program you always have to use 0:01:05.753,0:01:07.526 these quotation marks around it. 0:01:07.526,0:01:10.112 Otherwise you're going to get[br]some really weird error messages. 0:01:10.112,0:01:12.606 And remember, if you do see[br]those weird error messages, 0:01:12.606,0:01:15.359 just be sure to double check[br]that you are remembering to use quotes. 0:01:15.359,0:01:17.232 Great! so now we're using quotation marks, 0:01:17.232,0:01:18.755 and we don't get an error anymore. 0:01:18.755,0:01:20.928 But you might have noticed[br]that nothing is happening, 0:01:20.928,0:01:22.217 and it's still blank, 0:01:22.217,0:01:24.890 but what is kind of strange is[br]if we set a "background," 0:01:24.890,0:01:29.114 something, say just a red, [br]then we see that it is actually there. 0:01:29.114,0:01:33.120 It's just in white, so the problem is [br]if we think about it, 0:01:33.120,0:01:36.106 that we were writing white text, [br]onto a white background, 0:01:36.106,0:01:37.952 and that's why we couldn't see it. 0:01:37.952,0:01:40.451 So that seems a little bit silly, [br]why were you writing 0:01:40.451,0:01:42.940 white text onto white background? 0:01:42.940,0:01:45.893 Well, we could just change it, [br]because we learned how to set 0:01:45.893,0:01:47.006 the fill of something. 0:01:47.006,0:01:49.891 And just like we can set the fill [br]of a rectangle or a line, 0:01:49.891,0:01:51.796 we can set the fill of text to anything 0:01:51.796,0:01:54.231 just like before, and then there it is! 0:01:54.231,0:01:56.410 It shows up without [br]needing the background, 0:01:56.410,0:02:00.609 so let's look a little bit more[br]to how this text thing is working. 0:02:00.609,0:02:02.324 The first part, is obvious enough, 0:02:02.324,0:02:04.419 it's just whatever text we want to write. 0:02:04.419,0:02:06.584 The next part, if we change it, 0:02:06.584,0:02:08.949 we can see that it's basically[br]just how far over, 0:02:08.949,0:02:11.776 and the next one[br]is just how far up and down. 0:02:11.776,0:02:14.822 That probably looks really familiar[br]from when we were just 0:02:14.822,0:02:15.868 drawing rectangles. 0:02:15.868,0:02:17.620 One thing that's a little bit tricky 0:02:17.620,0:02:19.542 is that text has these two coordinates 0:02:19.542,0:02:24.256 specify the lower left part, [br]so this corner of the text. 0:02:24.256,0:02:27.222 While with rectangles[br]it's the upper left, this corner. 0:02:27.222,0:02:30.280 And that can seem like it was[br]just designed to confuse you, 0:02:30.280,0:02:32.761 but it's just something[br]you kind of have to remember. 0:02:32.761,0:02:34.913 And we can even experiment [br]and see it for ourselves, 0:02:34.955,0:02:39.219 by we can set this to say, "height,"[br]and we can see that, 0:02:39.219,0:02:42.448 yeah, it is setting the height[br]to be this lower left coordinate. 0:02:44.358,0:02:46.225 Or we can set it to zero, 0:02:46.225,0:02:50.002 and you think what should we expect then? 0:02:50.002,0:02:53.391 And we don't see it at all, [br]but if we slowly start increasing this, 0:02:53.391,0:02:56.326 we can see that, yeah it is kind of[br]just like peeking out there. 0:02:56.326,0:02:59.782 Because again, that lower left coordinate[br]is what we're specifying, 0:02:59.782,0:03:01.754 not the upper left. 0:03:01.754,0:03:05.611 Okay, so enough of analyzing[br]this text thing, 0:03:05.611,0:03:07.278 let's go ahead and make it better. 0:03:07.278,0:03:09.514 For example, [br]let's start to make it bigger, 0:03:09.514,0:03:12.435 we can do that with "textSize" [br]which just tells the program 0:03:12.435,0:03:13.886 how big to draw the text. 0:03:13.886,0:03:16.099 And we can make it "30,"[br]which is pretty big, 0:03:16.099,0:03:17.688 we can make it even bigger, 0:03:17.688,0:03:20.457 or we can make it really, [br]really, really, really small. 0:03:20.457,0:03:23.034 Whatever we want, so let's go ahead[br]and draw your name 0:03:23.034,0:03:25.641 and maybe a little message[br]about yourself underneath. 0:03:25.641,0:03:28.646 Since I don't know your name,[br]I'm just going to draw my name. 0:03:28.646,0:03:30.871 You can switch it to yours in a moment. 0:03:30.871,0:03:34.264 So using what we just learned, [br]we can say "text("Sophia")" 0:03:34.264,0:03:35.887 and there my name is. 0:03:35.887,0:03:38.135 And then maybe want to put [br]a little message underneath, 0:03:38.135,0:03:43.493 like, "I like puppies[br]and guitars and coding." 0:03:43.493,0:03:46.709 So that's great, [br]except that we obviously need 0:03:46.709,0:03:48.945 to change the positions [br]so they don't overlap. 0:03:48.945,0:03:51.647 And oh no, no, [br]that's kind of a long string of text, 0:03:51.647,0:03:55.449 so let's change it[br]to be a smaller text size. 0:03:56.499,0:03:58.633 And there we go, that's pretty good. 0:03:58.633,0:04:00.964 Except, I don't know,[br]it's kind of boring having 0:04:00.964,0:04:04.393 them both be blue,[br]so let's just change the "fill," 0:04:04.393,0:04:06.932 and let's make it maybe a nice, [br]hmm I don't know, 0:04:06.932,0:04:09.804 maybe a nice, like, purple. 0:04:09.804,0:04:13.126 Alright, and there you go, [br]that's all there is 0:04:13.126,0:04:16.099 to drawing text and changing [br]colors and changing size.