Transcript from the "Pen Tool" Lesson
>> I just want to point out there's a whole series on YouTube too around building a full platformer, which I think at the end it becomes like a clone of Super Mario Brothers 3 towards the end, or some along those lines. That's definitely worth taking a look as well.
[00:00:14] It's ten hours of stuff. I want to show you about some of the other things you can do. Some of these we'll just kind of take a look at some of the code and all of this is available and will always be available both the full working playgrounds, but then also some of the step by steps of some of the stuff we also kind of talked about as well.
[00:00:33] Those sections are like if we go here, check it out. These all live in the extensions part. So none of these are available normally. So I think it's fun to treat them like extensions. There's this idea of a pen tool, and let's actually do that. I'll show you an example.
[00:00:50] Pen tool is basically, there is a limit to the number of sprites you can have on a page of some kind of performance pieces. If you wanna literally just be able to draw shapes and do graphics with vectors, you can use the pen tool. And we've got some really kinda of cool examples around that as well.
[00:01:07] So we can take a pen and it's basically you can erase stuff you can basically move to a given point on your screen. So like we know the coordinate grid, you can set the pen size and color you put the pen down. You move the pen, I'm explaining how a pen works to you, right?
[00:01:28] Or a marker or anything along those lines. You move the pen, you pick it up. That's what picking up a pen does. You can move it somewhere else, you can put it down, you can change the color of a pen, but it opens up another hole, like before we've just moved Sprite around, right?
[00:01:45] So I can take one where I, put the pen down. I changed his color on every tick. If you look at this, we start when the green flag is clicked erase all set the pen size to 10. Why not? This is the setup. Set the pen color to red.
[00:02:01] Go to negative 40 y zero. Put the pen down for 100 times move it one step and change the pen color by one, right? And that will move across the color spectrum and draw it onto your Canvas. And again you can get a little bit crazier with the code where you can like set move go all the way to the up upper left corner of the screen put you know put the pen down until you've hit the one course of this y-position.
[00:02:33] So repeat until you hit the bottom, right, put the pen down repeat until you hit the right side and then go ahead move it down and keep going, so what you end up with is this. Right? And that's kind of using code to make art. Obviously very simple art in this case, but like that's all happening through programming the pen to kind of like do the things that you want, right?
[00:03:29] Which is draw a polygon with how many sides and how many lengths for each side. And all it does is divide 360 by the number of sides and draw for that length. Seems like a relatively simple piece of code, right? I can, however, say, okay, do this seven times or however many times, right?
[00:03:48] Do it for a three-sided polygon, also known by some people as a triangle, right? Then go do it change the color go do it for a four-sided one some people call that a square, all the way up to a pentagon so on and so forth. And you draw something that's a bunch of squares, you can draw something like this as well we saw in the very beginning.
[00:04:07] All right, and that's all from like programming it. And again, that's simply a lot of stuff we saw from the platformer, or some of the previous games that didn't go in up to a 20 sided polygon, right? You can go ahead and that's really just you bump that number from seven to 20, you get the larger one.
[00:04:23] It will go through and be able to like just draw those with, honestly, this code operate this custom block, right? Just goes through draws each one over and over. So not only can you make games, you can make little art projects. There's a music extension in there as well, where you can have a drum kit.
[00:04:42] Again, I don't believe this thing actually supports sound while I'm around, but when you're along with your parents, I'm sure it does. And you can do all of that kind of stuff. I've just gonna be blissfully ignorant about all of that.