Introdução ao Scratch - Curso de Algoritmos #05 - Gustavo Guanabara

1.01M views3944 WordsCopy TextShare
Curso em Vídeo
Aprenda como utilizar o Scratch, uma ferramenta que auxilia no aprendizado de Algoritmos e foi criad...
Video Transcript:
Introduction ♬ ♬ Hello, welcome to another lesson of their course Algorithm! My name is Gustavo Guanabara, I am your teacher and now we will take a break from studies of algorithms, concepts for me to show a very important tool and valuable to further help in your learning algorithms. In fact, I showed in class 1 to 5, the Visualg and this is the tool that we will use first but there is a tool that I use in my classroom and would like to share with you, and I think that helps a lot, especially for who is having difficulties here.
So if you watched the class 1 to 5 and felt some kind of difficulty, probably you will now be able to eliminate these difficulties, for I will present to you the project "Scratch" . . .
"Scratch" is a project created by a university in the United States, very famous The Massachusetts Institute of Technology (MIT) and this project has been created since 1993, but only in 1997/1998 is that it was released to the community and since it is available, you just look for the project "Scratch". But he is already part of your travel package you downloaded there on the site: www. cursoemvideo.
com By using this site, you can download the Algorithm Course area your package and within it is the version of "Scratch" for Windows and if by chance you are using as I here use the Mac I'll use the "Scratch" in a virtual machine on your Mac. or if you use any version of Ubuntu a Linux version, you can download on the official website of "Scratch" by doing a simple search for the tool's name on Google and you will have access to it. So it's a tool that was created in order to teach programming logic for children with a very great simplicity and in the end we all have our child within us so it's a fun way to use the "Scratch" and you will see from now I will demonstrate this tool for you and how simple it is to create a logical Using this environment.
So let's go here to the computer, so that you understand what I mean . . .
After downloading the package you will install the tool and installing applications on Windows is very simple, forward, forward, forward and concludes. Then you will have here the "Scratch" will open the application . .
. Putting it here in full screen. Here you will see the "Scratch" environments Basically, you have a menu up here .
. . button to save button to open and button to share .
. . This is cool because you can share your projects.
Here still the top bar . . .
. . .
You have some stamping tools, cropping, you can increase or decrease an object for example, can increase the object . . .
. . .
Or I can click here and slightly decrease the object. Up here I change the views . .
. . .
. Being able to put on a small display giving focus to the code . .
. . .
. I can go back to default view distributing the focus, or, focusing only on the execution where it will get full screen just to execute the logic. At the bottom, we have the "sprites" who are the characters that are created, including the stage that is this white part then we have here for example only one object, which is the cat to work on it.
We can draw an object by clicking here. We can add an object with "sprite" already preset, or any file ". gif" serves as a "sprite" or, you can create a surprise object by clicking on the last button.
Here in the middle, we have the area code, which is where you will get to our routine. We also have the costumes, which are the costumes worn by the cat, here 2 or cat sounds them, in which case here's the sound of "Meow". Returning to commands .
. . In the left corner we have the commands, Here you have several categories of commands then we move categories, appearance, sound .
. . .
. . And note that each one of them that I'm clicking, it has a series of commands or instructions within it.
So, it all starts here in the movement section and it is here that the "Scratch" will be worked out. So you can see that it is an extremely simple tool, but the result of it is extremely powerful. The features of it is really cool!
You must remember very well, in one of the previous lessons, I think it was the class 3 we saw arithmetic operators and we did a logic to ask the user to enter two numbers and show the sum of them. Let's make it happen in the "Scratch" with a focused program for children. Let's do the same thing working.
But above all, do not forget the curse of "Hello, World! " Let's do the kitten talk "Hello, World! " woe to us!
It all starts when we click the green flag. We have come here in the control tool and when you click the green flag, it will happen something. I will come here "look" I will ask for the cat to say for 2 seconds, "Hello World!
". Now I just click the green flag . .
. He will write "Hello, World! " for 2 seconds and then disappears.
I can also make a sound causing the cat touch sound "Miau" and then say "Hello, World! ". ♪ "Miau".
Note also that each of the commands fit into each other. For example, if I fit the sound "Miau" and leave the "Hello, World! " outside.
. . .
. . By clicking .
. . .
. . ♪ "Miau".
He meowed, but he wrote: "Hello World! ". Only the pieces are fitted together, they will be able to serve for execution, breaking one of these parts has a waveform upon which are the control parts.
Let's leave that aside here, I just drag this area to the command area that it deletes the commands. And we will do the following . .
. . .
. We put a sensor here, asking not what your name, I will ask . .
. Tell a number. And then immediately have an answer.
Note that the response block does not fit into any of them, the response block will only fit into rectangular objects. Let's leave it here and we will ask for another number. Enter another number .
. . Also, we will leave the answer here.
These answers can not come loose and not floating, for we have seen that commands that are floating on the screen are not executed. And then I have to get the answer on what the user typed and store somewhere. Have you ever seen me, which the local name where value is stored, did not you?
The name "variable" tells you something ? ! For the "Scratch" also has variable!
Then we create here, we have the area of ​​variables . . .
. . .
We will create two variables: A "N1" variable . . .
. . .
I will create another variable, "N2". The variable names, follow the same rules that we saw earlier. Now, I will do the following .
. . .
. . I will change the value of "N1" .
. . .
. . To 0?
No, I will change to "reply" first. I'll fit in here the question and I will do the same thing only now changing the "N2" . .
. . .
. for. .
. . .
. My second answer! So now, he will ask: "Say a number" You'll wait and when he has the answer he will play in the "N1" variable.
Here the same thing: "Tell another number," he will wait when the user says the other number the answer is going to N2. Let's calculate the sum, creating a variable . .
. . .
. "S" and my variable "S" It will be given as follows: "Switch" S "to" CAUTION with the "Change" S "for" and "Change" S "for" "Change" S "for" will add values ​​to the variable, "Switch" S "to" will change the internal value of it without adding anything. Then, the block that we are using is the "Switch to" and not the "Change for.
" The "S", will be the sum of "N1" to "N2" and here we come in the area of ​​operators, you will see that there are the addition of operators, subtraction, multiplication and division, we have seen in previous lessons. here we put an addition operation. Go to the areas of variables by placing the "N1" more.
. . the "N2".
Lastly, we in the "appearance" sending the cat to say by 2 seconds the value of "S". then I go to the variable and will put "S" here. Let's run by clicking the green flag .
. . the first thing he's asking me is "Enter a number" .
. . I have here, the "N1" variables, "N2" and "S" I will enter a number to it "3", pressing the "Enter" 3 has come up here then he asked me the other number that will be placed here in "N2".
we put "5" and when I press "Enter" it will add 5 to 3, will give me the result . . .
he gave me the result "Hello" rs because I put here by "S" seconds by 8/2 I have to put it here and I put in the wrong place! We will run again . .
. . .
. "Say a number" 3 "Tell another number" 5 and the sum was: 8. If I want to show instead of just "S" display a message I can use a join operator putting here: join .
. . .
. . the message.
. . the sum worth .
. . .
. . "S".
. . and I will put "Tell (the junction between a) Sum Valley" S "" for 2 seconds.
I will give a space here after is to stay separate . . .
. . .
And let's run: "Say a number" 4 "Say another number" 2 2 . . .
4 . . .
The sum is worth 6! So, it looks a lot like the Visualg not ? !
But the coolest "Scratch" is that besides the interactivity with values ​​and operators, you can create interactivity with this character that is showing up there on the screen for example, I will enter two numbers and these numbers will be added and the number that result it will take a number of steps on the screen . . .
let's see how it works ? ! So from now on I have the sum, it will show me the sum and besides, let me pull the cat here, it will give the amount of steps forward.
To take a number of steps, I have here in the control section an area "Repeat" and here he repeats 10 times I will not want to repeat 10 times, I'll want to repeat the sum of steps that he gives. Then repeat for as many times as the sum, in my case here he repeats 6 times this run, going forward every situation it will give a number of different steps. To take a step, there is a movement 10 steps.
In fact, it will not take 10 steps, it will take 1 step 10 steps is the distance it will travel. Then it will move 10 steps and I'll change his appearance for next costume. The change in costume happens this way, it will take the cat with an open leg, then the cat with closed leg .
. . .
. . After the cat with an open leg, then the cat with the closed leg and will merge it.
So you can see right, I'm going to wait control command here, only that it will not wait one second, he will wait 0. 2 seconds. Then in the "Repeat" it will move 10 steps, change the costume, and wait 0.
2 seconds. Note here, that I have a structure that is encompassing these three commands. These three commands will be considered as a block.
So let's run . . .
. . .
It will ask a number . . .
I will inform 5 . . .
. . .
Another number, I will tell 3. Then this will give 8 and it will take 8 steps after showing the result. OK?
I will run again . . .
. . .
1 + 1, it will give only 2 steps. OK? Similarly, if we report 10:10 .
. . .
. . He will walk 20 steps forward.
Interestingly, not ? ! And the "Scratch" has some other very important features, I'll show here some interesting things and this serves to show you pro your nephew, to her son, for any child who knows because she will learn while playing in fact she will find that will be playing with something, but in the end she will be learning algorithms which are things that usually people find it difficult I honestly do not understand why!
But a lot of people that find this difficult. I will create another example to show some features of "Scratch" clicking "File," "New" I will not save the current project, it will create again the object, I will click with the right mouse button in the "sprites" and I will delete this object. My stage is empty.
Let us set up the first stage . . .
. . .
Clicking here on screen background, I can import The "Scratch" comes with several funds already pre-modeled and I'll put here for example, "outdoors" I will select one . . .
any street here, for example. . .
in front of the cinema. insert here the stage . .
. . .
. And I will create a new character. for the character, click here and I will see several characters.
In my case I have the area of ​​"Characters". On second thought I will select "People". We have the area of ​​people and have several people here .
. . .
. . I will choose one of them .
. . .
. . Is a lad here, walking .
. . .
. . A, B, C, D and E, then .
. . I will first open the "A" and it will create one here, I will call this person, changing up here Joseph.
then this is the Joseph and then I come here in "costumes" and I can import other "sprites" Joseph. I will open the B . .
. . .
. Then the C . .
. import . .
. . .
. C. After importing .
. . .
. . D.
Finally, import . . .
. . .
E. Then note here that for the same person Joseph, I have 5 "sprites" which are 5 positions walking him. We will come here in the command area, and let's put it this way, when the flag is clicked, I will repeat forever, let's put here forever .
. . .
. . ever.
. . I will change his appearance to the next costume and again for you to realize this change, I'll have to wait .
. . the .
. . I put very little here 0.
1 seconds . . .
I'll click on the flag . . .
. . .
And José starts to walk! In fact it is only by changing the costume and waiting "forever". All are within this framework that encompasses these two commands, It is considered a repeat "forever.
" I will stop clicking "stop everything". He stopped. I'll put Joseph here and beyond next costume, I will make a move 10 steps.
He will start walking . . .
. . .
Only when he gets in the corner, it will be stopped but still walking can see ? ! But he left screen edge.
I'll stop. . .
. . .
Pull him back here . . .
. . .
And I will give a command where: if you touch the edge back. Simple! Clicking on the flag, he's and when he touches the side .
. . he comes back.
But he is coming back, upside down. I'll let him return to the natural position . .
. . .
. I'll stop. .
. . .
. And I will change the location here of Joseph. Here he turns in any direction, here it just turns on the left and right, which is what I want, and, in the latter, it will not turn in any way.
So, In that first you saw it turn upside down, Look! With the second option on . .
. . .
. he goes. .
. . .
. And when he hits it back. And this option here the last one, he will walk, and it will never turn.
Hitting on one side or another, it will always remain facing to the right. In my case the best option is here the second. If I want to, as we have seen, reduce the size of it, I can decrease, I can even remove this wait, and it will go faster.
And another thing you can do is interactivity with the keyboard keys, for example, I can make the Joseph who is walking like crazy here on my screen, every time I press 'space' it take a leap, let's see how this works: So there it is, I will stop my program so that it can rest, and I will put the following here have another way to start, I have another early, which is when the space key is pressed, or can be any other key, simply enter here, arrow up, down arrow, whatever it is, there is already possible to create small little games, and when the space key is pressed, I'll set up a movement changing "y" . . .
For 10 . . .
, that is, it will add 10 to the "y" . . .
and for that I will set up a repetition 10 times. This will cause it to go up. Soon after, I will make another repeat 10 for him to come back to the same place and will set up a motion changing "y" .
. . .
. . By -10.
Note that now I used the "Why" and not the "To". So when I press the space it will make 10 up, then 10 down. Let's run .
. . pressing the space bar .
. . .
. . He does a little jump and I can create some interesting things!
Let's create another form of interactivity here, then I will create a block that it is floating on the screen and when Joe hit his head on it I will add one point, I will create a score. let's create a little game here! Once again I will stop programming I will create a new "sprite", so this time I'm going to paint a this "sprite" then I will select here orange color, I will draw a rectangle, holding the "shift" it draws a square, I will draw a line, white for me to create more or less a brick.
I'm holding the "Shift" for him to be straight, very simply you can caprichar more, his son, his nephew, doing here a brick . . .
. . .
A simple thing to do, just give freedom to your creativity! and creativity of a child or young person is much bigger than my right ? !
Then we have the brick created evil and nastily, I will slightly decrease, every click it decreases a little, I believe that is already good! I will make the brick stay here, change his name to brick, I will return to Joseph, and in the middle of the jump, I'll see if something happened putting here: if I put this repeat later, if anything happens, and that something will be a "sensor" when it is "touching", that is, if Joe is playing in "Brick", i. e.
, if it touches the wall, I will play a sound see that he is no sound, so I import a sound, here in "Effects", we have an effect called "pop" . . .
♪ ♪ Pop Pop . . .
right? ! .
. . then the command, "If Joseph is playing in Brick" Touch the "pop" sound, we will see.
. . ♪ Pop ♪ ♪ ♪ Pop, Pop ♪ ♪ it just makes noise, ♪ Pop ♪ when he touches the brick.
Let us go a little more . . .
and besides playing the brick, I'll create a variable it will be variable points, where, at the beginning of all, in my program when the green flag is clicked I'll put point = 0, and whenever . . .
hear the sound, I will set switch points by 1, i. e. , it will add more to 1 points.
Let's start here with point = 0, I started my program and every time I lean against the brick, it will add 1 more point in looking only: ♪ Pop ♪ ♪ Pop ♪ ♪ Pop ♪ ♪ Pop ♪ ♪ Pop ♪ ♪ Pop ♪ Did you see how you understand the "Scratch" much easier? And actually what is in the middle is an algorithm, is a set of steps, uses variable, you can do arithmetic expressions then this tool is phenomenal for this. During the first class, while we are seeing the fundamental concepts of algorithms, I'll try to make the first and the second part always using "Scratch" and "Visualg" in parallel, so you can run it simultaneously and be able to understand the two tools.
You as an adult, can learn from the "Visualg" but you can show the "Scratch" for a couple, for a teenager, for a child, in short, that can be interested in it. Today any child interested in video games so why a child may not be interested in creating an electronic game of it ? !
then gets the hint, I hope you enjoy quite the "Scratch" again, it is a free design I'm just using free tools, in the course packet video you downloaded, has the "Visualg" has the "Scratch", but you can search for any of these tools, they are free on the Internet they are not my exclusives they are used in my classroom for a long time I use it in my room, when I go into a classroom to teach youth and adults, I use these tools, then use them to make people more interested in programming, They are more interested by the construction of algorithms and so we will train many programmers out there! That's my goal, that's my mission! I hope you enjoyed this lesson, I hope you have understood The basic operation of "Scratch", then from the class that comes we will do some exercises and all these exercises will serve as a base using the "Scratch" and "Visualg" in parallel.
I have all the favors that always ask for you: Then, by clicking here you will sign the travel channel video, whenever you have a new class, a good class, you are warned, the tip that I always give, side-side button register, has a small gear after you are enrolled, has a gear, go there and click to receive in email this channel, because the channel is good, this channel helps me, this channel gives me good lessons for free! by clicking here, you will have access to all classes, is a playlist we are already in the fifth class are many lessons so not to miss any, you Click here and access the playlist be sure to sign up, do not forget to enjoy the video, to share show people what work we have, show people I'm trying to teach algorithms for young free of charge, over the Internet in a way that almost no one did this world! So it's a project that hugged her heart, the Hostnet, which is the sponsoring company I would like to thank all the directors of Hostnet who believe in my work who believe in all the projects that I have then I wanted to once again invite you to visit the site of Hostnet whenever you need a place to host your site, www.
hostnet. com. br, and this place!
This is a company that believes in the course website video this site that is teaching you HTML, He is teaching you algorithm and will teach you many things around the project, for life! So a big hug, good studies, do not forget to practice, install the tools, train, practice and show others! A big hug and see you soon!
Copyright © 2024. Made with ♥ in London by YTScribe.com