With an account in hand, it is time to sign in to Scratch and create your very first program. When you are done with this tutorial, you’ll be able to create an awesome first project that you’ll want to share with your friends and family.
cratch is intended to be easy enough for anyone of any age to pick up. Anyone wanting to learn how to program can easily create an account and start learning how to code. Coding is such a powerful skill to learn, and for many software engineers, their first line of code is written in Scratch.
Scratch is ideal for the following individuals:
Anyone can learn how to code. This tutorial is going to walk you through all the steps required to get your very own Scratch account.
What You Need Before Getting Started:
- Working computer with internet access.
- A parent or adult, if under the age of 13.
- A Scratch account to save and share your projects
What You’ll Learn:
How to create your first program. This program will allow you to move an onscreen character with your keyboard.
Step-by-step instructions for creating your first program.
Log in to Scratch and start a new project.
- Click on sign in on the top right corner of the navigation bar.
- Click on Create right next to the SCRATCH logo on the left side of the navigation bar.
- You’ll be greeted with a blank canvas. Here we will create our very first Scratch project. Let’s get started!
Step 2: The Scratch Editor
There is a lot going on with the Scratch editor if this is your first time. Let me show you around. The first thing you will notice on the left are all these colorful circles and puzzle shaped pieces. These are called blocks in Scratch and they are the foundation of Scratch. These blocks allow you to create program in a very simple, yet unintuitive way. There is a block for just about anything in Scratch. As we progress with these technical posts, you will explore more blocks and expand not only your knowledge, but also your programming skillset.
The big empty canvas in the middle is where you’ll drag and drop blocks to actually create your programs. Here, you will piece together multiple blocks which will allow you to “code” the functionality of your program.
The right side of editor window is where your program comes to life. The top right portion is where you activate your code and see the execution of the code you created.
Below that, you will see sprite pane. This is where you control the graphics that are utilized by your program.
Now that you know how to navigate around the editor, let us start to put together your very first Scratch program.
Step 3: Your First Program
Getting started – Setting up your program
First thing you will want to do is change out your sprite. You can keep the default sprite, or you can delete it and pick out a new one. For the purposes of this tutorial, we are going to swap out the sprite.
Start by deleting (click on trash) on the default sprite.
Click on the cat icon towards the bottom right corner.
Pick any sprite that you find interesting.
Let’s double check the costumes for your sprite. Each sprite will be different so if you do not feel comfortable, feel free to follow along with my example.
On the left side of the screen, click on Costumes.
From there, edit your sprite. I only need the one sprite, but if you want to animate your sprite, you can do so by creating additional costumes here.
Let’s switch back to the code editor.
Most Scratch programs start off with an event block. This block will allow you to “trigger” your program and bring it to life. Without this, most code will not run properly.
Click on events and then select “When (Green Flag) Clicked” block.
Drag and drop “When (green flag) clicked” to the coding pane.
Next, click on motion and then select “go to x: (0) y: (0)” block. This will allow you move your sprite around the screen. Connect the two blocks together as shown below.
Next, scroll down within the motion blocks and find the “set rotation style” block. Change the value from left-right to all around.
Now for some fun stuff. Scratch also has built in extensions that allow you to extend the capabilities of Scratch. We are going to be using the “Pen” extension with our first program to make a cool writing effect.
Click on the lower left corner to show Scratch Extensions.
Click on Pen to enable the special “pen” blocks.
Drag and drop the “Erase All” block. This will basically reset the canvas every time we execute the program.
Next, drag and drop the “set pen color to:” block. Configure the color value to whatever color you like.
Next, drag and drop the “set pen size to” block. Configure the size of the pen to whatever value you want.
Next, drag and drop the “pen down” block. This will enable the pen feature and give the appearance of a pen writing.
Making the character move
Now it is time to make the sprite write something.
Click on events to display all the event blocks.
Drag and drop the “When (SPACE) key is pressed” block. Change the value of space to right arrow.
Next, we are going back to the motion blocks and this time, drag and drop the “point in direction” block.
Drag and drop the “move (10) steps” block.
Now, lets go back to the pen blocks and select ” Change pen color by:” block.
Testing time. When you click on the green flag and then click on the right arrow key, your sprite should start moving right and a line should be shown on the screen along the path of your sprite.
Awesome, time to copy the code and enable the other directions.
Copy the entire set of blocks we used to make the sprite move to the right.
Edit the key pressed to left, up, and down. You’ll need to basically copy the code three more times, one for each direction. Your code editor should look like this:.
Next, for each of the new blocks of code, edit the point direction to reflect the arrow key pressed. You need the following values:
- 90 degrees for right arrow
- -90 degrees for left arrow
- 0 degrees for up arrow
- 180 degrees for down arrow.
And that’s it! You created your very first Scratch program. We have many more to go, so make sure you are following me on social media and our YouTube channel. If you’d like a video version of this tutorial, check out the video below. Don’t forget to like and subscribe!