How to Make a Virtual Town in Scratch | RPG | Tutorial

Alphabets Sounds Video

share us on:

In this lesson, you will learn how to create a virtual town in Scratch by designing a main character, adding interactive backgrounds, and incorporating various locations and characters. You’ll also discover how to enable movement and interaction using arrow keys and event blocks, allowing players to explore and engage with the town. By the end, you’ll have a personalized virtual town to share and enjoy!
  1. What is the first step you need to take when creating your virtual town in Scratch?
  2. How can you make your main character talk to other characters in the town?
  3. What do you need to do to move your character between different locations in your virtual town?

How to Make a Virtual Town in Scratch

Hey there! Today, we’re going to learn how to create a fun virtual town using Scratch. By the end of this guide, you’ll be able to design your own town with characters and places where players can walk around and interact. Let’s dive in and start building!

Choosing Your Main Character

First, we need to pick a main character for our game. This character will be the one that walks around the town. To do this, click on “Choose a Sprite” and select any character you like. For example, you might choose a character named Jordan.

Creating a Background

Next, let’s add a background for our town. You can choose a background from Scratch or create your own. To make a top-down view, click “Paint” under “Choose a Background.” Use the rectangle tool to draw a green rectangle for grass. Then, use the paintbrush tool to draw a path across the grass. Choose a faded orange or brown color for the path.

Adding Characters to Talk To

Now, let’s add a character for the player to talk to. Click “Choose a Sprite” and pick a character, like a Unicorn. To make the character talk, go to the “Looks” category and drag out a “Say” block. Write a message for the character to say when clicked. Use the “When this Sprite clicked” block from the “Events” category to make it happen.

Creating Multiple Locations

Let’s make our town more interesting by adding more locations. Click “Paint” under “Choose a Backdrop” to draw new backgrounds. You can draw a house, a lake, or anything you like. Use different colors and shapes to make each location unique. You can even copy and paste shapes to save time.

Moving Between Locations

To travel between locations, add arrow Sprites. Use the “Next Backdrop” block from the “Looks” category to move to the next location when an arrow is clicked. For going back, add another arrow Sprite, flip it horizontally, and use the “Switch Backdrop to” block to go to the previous location.

Showing Characters in Specific Locations

To make characters appear only in certain locations, use the “Hide” and “Show” blocks from the “Looks” category. Use the “When Backdrop switches to” block from the “Events” category to control when a character appears or disappears. For example, make the Unicorn show up only by the lake.

Moving the Main Character

Let’s make the main character move with the arrow keys. Use the “Change X by 10” block from the “Motion” category to move right and “Change X by -10” to move left. Use the “When key pressed” block from the “Events” category to make this happen when the right or left arrow keys are pressed. Do the same for moving up and down using “Change Y by 10” and “Change Y by -10.”

Enjoy Your Virtual Town

Now you have your own virtual town where characters can move around and interact with different locations. You can add as many characters and backgrounds as you like. Have fun creating your town, and don’t forget to share it with others. Happy Scratch programming!

  • What kind of town would you like to create in Scratch? Can you think of some places or characters you would include in your town?
  • Have you ever visited a town or city that had interesting places to explore? What did you like most about it, and how would you add those features to your virtual town?
  • If you could talk to any character in your virtual town, who would it be and what would you ask them? Why do you think it would be fun to have a conversation with that character?
  • Design Your Dream Town: Grab some paper and colored pencils. Draw a map of your dream town, including places like parks, schools, and shops. Think about what makes each place special. Once you’re done, share your map with a friend or family member and explain why you chose each location.

  • Character Conversations: With a friend or family member, create a short play where you pretend to be characters from your virtual town. Write down what each character might say when they meet. Practice your play and perform it for others. This will help you think about how characters interact in your Scratch town.

  • Explore Real Towns: Take a walk around your neighborhood with a family member. Observe different places and think about how they could be represented in your Scratch town. Take notes or draw pictures of interesting things you see, like a unique building or a beautiful garden. Use these observations to add new features to your virtual town.

Here’s a sanitized version of the YouTube transcript:

Hi everyone! It’s Zoë from the Scratch team, also known as Zinnea. Today, I wanted to show you how to make a virtual town in Scratch. By the end of this video, you’ll be able to create a game where you can design your own town with your own characters and locations, allowing players to walk around and interact with different characters. You can use this to create your own story or open-world game, or anything else you want. So, let’s get started!

First, let’s pick a character to be the main character of the project, the one that will walk around. I’ll hover over “Choose a Sprite” and click “Choose.” You can pick any character you want. I think I’ll pick Jordan.

Now, let’s add a background. You can click the button that says “Choose a Background” if you want to select one of the backgrounds that are already in Scratch. However, you might want a top-down background, which is viewed from above. Let me show you how to draw one easily. Just hover over “Choose a Background” and click “Paint.”

I’ll click on the rectangle tool, set the color to green, and drag a rectangle that fills the whole stage. Now, I’ll draw a path across the grass. I’ll click on the paintbrush tool, set the color to a faded orange or brown, and set the paintbrush size to something really big, like 100. Then, I’ll just scribble with the paintbrush, and there you go, that’s a path!

Now we have a simple top-down background of a part of the town. Next, let’s add a character for the player to talk to. Again, I’ll hover over “Choose a Sprite” and click “Choose.” You can pick any character you want to be in your town. I think I’ll pick the Unicorn.

Let’s make it so this character can talk. I’ll go to the “Looks” category and drag out a “Say” block. You can click that to have the character say something. You can write whatever you want in here. Let’s make the character talk when we click on it. To do that, I’ll go to the “Events” category and drag out a “When this Sprite clicked” block.

Now, when I click on the Unicorn, it says “Hello.” That’s how you can add a character you can talk to. Now, let’s make the player able to walk between multiple locations. Let’s draw a couple more backgrounds for our town. I’ll hover over “Choose a Backdrop” and click “Paint” again.

Now you get to think about what you want to be at this location in your town. I think I’ll make a house here. I’ll make another green rectangle for the grass. Let me show you my simple way of drawing a house. I’ll set the color to brown and draw a rectangle, then pick a different shade of brown and draw another rectangle on top. I say that’s a house. Of course, you can draw it however you want.

I’ll also add a lake on this background, so I’ll set the color to blue and draw a little squiggle. Let’s draw one more background. I’ll paint a new one and make another green square. For this one, I’ll do three houses on a street. If you don’t want to draw a house again, you can click on this background and copy the house.

To copy one shape, you can click on it and click “Copy,” but we want to copy all three shapes. So, I’ll click on one part and hold down Shift while clicking the other two shapes. Now I’ve selected them all and will click “Copy.” Then, I’ll go down to this background and click “Paste.” Now, I didn’t have to draw the house again. I’ll put this over here, paste another house, and maybe make them slightly different colors.

Now we have three different locations for our town. The last thing I’ll do is name these backgrounds so I can know which one is which when I’m coding them. Now, let’s make it so the character can travel between them. There’s an easy way to do this. I’ll choose another Sprite and add this arrow Sprite.

Let’s make it so that when this Sprite is clicked, it goes to the next backdrop. In the “Looks” category, there’s a block called “Next Backdrop.” I will get that and place it under the “When this Sprite clicked” block. Now, if we press it, it goes to the next backdrop.

Let’s also add an arrow so that you can go to the previous background. I’ll add another arrow Sprite and flip its direction by going to the “Costumes” tab and clicking “Flip Horizontal.” Now, let’s go back to the code tab. When this Sprite is clicked, we want to go to the previous backdrop. In the “Looks” category, you can drag out the “Switch Backdrop to” block and choose “Previous Backdrop” from the menu.

Now, this block makes you go to the backdrop before. Let’s add the “When the Sprite clicked” block on top again. Now, you can click this button to go forward and this button to go backward.

Currently, the Unicorn shows up no matter what background you go to. Let’s make it so the Unicorn only appears at one of the backgrounds, like by the lake. Here’s how you do that: in the “Looks” category, there are blocks called “Hide” and “Show,” which you can use to make the Unicorn appear or disappear.

In the “Events” category, there’s a block called “When Backdrop switches to,” which you can use to make a character do something when the background changes. For example, I can make it so that when the backdrop switches to “House and Lake,” the Unicorn will show up.

Now, the Unicorn appears when we go to the lake. Let’s make it so that when we go to one of the other locations, the Unicorn will hide. When the background switches to the path, I’ll make the Unicorn hide. When the background switches to the houses, I’ll also make the Unicorn hide.

Now, if we travel between the backgrounds, the Unicorn only shows up at the lake background. This is helpful because now you can create a game with different characters at different locations, allowing players to walk around and meet them all.

Let’s add one last thing: let’s make it so that the main character moves when you press the arrow keys, so the player feels like they’re walking around the town. I’ll click on the main character to add code to her. In the “Motion” category, there’s a block called “Change X by 10.” This will make the character move to the right.

If you don’t already know, in Scratch, X represents how far a Sprite is from one side of the screen to the other. If you increase X by 10, the Sprite will move to the right, and if you decrease X by 10, the Sprite will move to the left.

Let’s make this happen when we press the right arrow key and the left arrow key. Go to the “Events” category and find the block “When Space key pressed.” Instead of the space key, let’s pick the right arrow key and place it above the “Change X by 10” block.

Now, when I press the right arrow key, Jordan moves to the right. Let’s make it so that when I press the left arrow key, she goes to the left by changing X by negative 10.

Let’s do the same for going up and down. In the “Motion” category, Y represents how high up a Sprite is. If I change Y by 10, she goes up, and if I change Y by negative 10, she’ll go down.

I’ll drag out the “When key pressed” block, choose “Up Arrow,” and make the Sprite go up when I press that. Then, I’ll drag out another “When key pressed” block, choose “Down Arrow,” and make the Sprite go down when I press that.

Now the character can move around with the arrow keys. So, that’s how you can make your own virtual town! You can have as many characters and backgrounds as you want. Also, there’s a link to this starter project in the description below, so you can remix it if you want.

I hope you have fun making virtual towns! I can’t wait to see them. I’ll see you next time, and Scratch on!

This version removes any informal language, personal anecdotes, and extraneous details while maintaining the instructional content.

All Video Lessons

Login your account

Please login your account to get started.

Don't have an account?

Register your account

Please sign up your account to get started.

Already have an account?