How to Make a Shop in Scratch | Tutorial

Alphabets Sounds Video

share us on:

In this lesson, you will learn how to create an interactive shop in Scratch for your game, allowing players to buy items like a red shirt. The process involves setting up a shop background, creating buttons to open and close the shop, and implementing a system to manage purchases based on the player’s coin count. By the end, you’ll be able to see the impact of purchases on your character’s appearance and set the stage for adding more features in future lessons.

How to Make a Shop in Scratch

Hey everyone! Today, we’re going to learn how to add a shop to any Scratch game. This is a fun way to make your game more interactive and exciting. We’ll start by adding one item that players can buy. Let’s dive in!

Setting Up the Shop

You can add a shop to any game you like. For this example, imagine a game where you can walk around, switch backgrounds, and collect coins. First, you’ll need a background for your shop. You can find one online, draw your own, or use a pattern from the Scratch library.

Creating Shop and Close Buttons

Next, let’s make a button to open the shop and another to close it. You can use a button from the library as a base. When you click the shop button, the backdrop will change to the shop. When you click the close button, it will switch back to the game background.

To keep things tidy, make sure that only the sprites you need are visible on each screen. For example, game sprites should only show in the game world, and the close button should only appear in the shop. You can do this by using the “when the green flag is clicked” block to show or hide sprites as needed.

Switching Between Shop and Game

Let’s test it out! When you click the shop button, send a message called “Go to Shop” to hide the game sprites and show the close button. When you click the close button, send a message called “exit shop” to make the game sprites appear again and hide the close button. This lets you switch between the shop and the game world easily.

Adding Items to the Shop

Now, let’s add an item that players can buy. We’ll start with a red shirt that costs two coins. Draw the shirt and create a new sprite with the item name, cost, and a buy button. Use the same show and hide code as the close button so it only appears in the shop.

Buying Items

When the item sprite is clicked, check how many coins the player has. If they don’t have enough, display a message saying “Not enough coins.” If they do have enough, create a variable called “bought red shirt” and set it to true when they buy it. Also, play a sound effect and decrease the coins by two.

Changing the Game Based on Purchases

Now, let’s make the purchase affect the game. Use an if-else block to check if “bought red shirt” is true. If it is, change the player’s costume to the red shirt. If not, keep the blue shirt. Check this condition when the player exits the shop, so their shirt color updates accordingly.

Try it out! Collect some coins, go to the shop, and buy the shirt. You’ll see your character wearing the red shirt. You can create different items for your shop by making variables to track purchases and changing the game based on what players buy.

What’s Next?

In the next part, we’ll add more features like a speed boost, buying multiple items, or limiting purchases to one per player. For now, have fun creating your shop, and I can’t wait to see what you come up with! Keep scratching!

  1. What aspects of creating a shop in Scratch did you find most challenging, and how did you overcome them?
  2. How do you think adding a shop feature can enhance the overall gameplay experience in a Scratch game?
  3. Reflect on the process of setting up the shop and switching between the game and shop backgrounds. What did you learn from this experience?
  4. How did you approach designing the shop and close buttons, and what creative choices did you make?
  5. What strategies did you use to ensure that the game and shop sprites were displayed correctly at the right times?
  6. Discuss the importance of testing the shop functionality. What insights did you gain from testing the switching mechanism?
  7. How did you decide on the items to include in your shop, and what factors influenced your pricing decisions?
  8. In what ways do you plan to expand your shop in the future, and what new features are you excited to implement?
  1. Create Your Own Shop Background

    Imagine what your shop would look like and create a unique background for it. Use Scratch’s drawing tools or find a pattern in the Scratch library. Once you’re done, share your design with the class and explain why you chose it.

  2. Design Shop and Close Buttons

    Design your own shop and close buttons. Think about colors and shapes that would make them stand out. Once you have your buttons, test them in your game to ensure they work correctly. Share your buttons with a partner and get feedback.

  3. Role-Play Shop Transactions

    Pair up with a classmate and role-play a shop transaction. One of you will be the shopkeeper, and the other will be the player. Practice buying and selling items using pretend coins. This will help you understand how transactions work in your Scratch shop.

  4. Invent a New Shop Item

    Think of a new item that players could buy in your shop. Draw the item and decide on a price. Add it to your Scratch project and write a short description of what it does. Share your new item with the class and see if they would buy it!

  5. Show and Tell: Shop Features

    Prepare a short presentation about the shop features you’ve added to your Scratch game. Explain how players can buy items and how these items affect the game. Demonstrate your shop to the class and answer any questions they might have.

Here’s a sanitized version of the YouTube transcript:

Hey everyone, it’s Zinnea here! Today, I want to show you how to add a shop to any Scratch game. This will be a two-part series. In part one, I’ll demonstrate how to add one item that the player can buy. Then, in part two, I’ll show you how to buy a speed upgrade that affects gameplay and more. So, let’s get started with part one!

You can add this shop to any game. I’ll use this game as an example, which is a combination of my virtual town game and my item collecting game. You can walk around, move between backgrounds, and collect coins. The link to this starter project will be in the description.

First, you’ll want to have a background that can serve as the shop background. I found one online, but you could also draw one or use a pattern from the library.

Let’s create a shop button to open the shop and a close button to close it. I’ll use a button from the library as a base to make these two buttons. When the shop button is clicked, I’ll switch the backdrop to the shop. Nice! When the close button is clicked, I’ll switch it back to the grass backdrop so we can toggle between them.

Right now, everything looks messy because all the sprites are showing on both backdrops. Let’s make it so that the sprites that should be in the game world only show when we’re in the game world, and the close button will only be present in the shop screen. For the sprites that we want to appear in the world, we can say “when the green flag is clicked, show,” and I’ll apply that code to all of them. For the close button, we can make it hide when the green flag is clicked.

Let’s try that out! We can also switch to the grass backdrop when the game starts. Great! When we click the shop button, let’s send out a message called “Go to Shop,” and we can make all the world sprites hide when they receive that message. The close button will show at that point. When the close button is clicked, we can send out a message called “exit shop,” which will make all the world sprites appear again and hide the close button. This allows us to switch back and forth between the shop and the game world.

Now that we have our buttons, let’s create some items that players can buy in the shop. To start, let’s make a red shirt that the player can buy for two coins. I’ll draw that red shirt quickly. Lovely! To put that item in the shop, I will create a new sprite and write out the item name and its cost, along with a buy button. I’ll give this sprite the same show and hide code as the close button so that it appears in the shop.

Now, when this sprite is clicked, we need to determine what should happen. It depends on how many coins the player has. If they don’t have enough coins, we should inform them that they can’t buy this item yet. To do this, I’ll drag out an if-else block from the control category. If the coins variable is less than two, we can have the button display “Not enough coins.”

If the player does have enough coins, we should keep track of the fact that they just bought the red shirt. We can do this by creating a new variable called “bought red shirt.” When the player clicks on it and has enough coins, I will set “bought red shirt” to true.

At the beginning of the game, I will set “bought red shirt” to false to indicate that the player hasn’t bought it yet. I will also play a sound effect and decrease the coins by two so that the player actually pays for the shirt.

Now let me show you how to make it so that this purchase affects the game. I want the player to do something different in the game depending on whether or not they have the shirt. I can drag out another if-else block and have them do one thing if “bought red shirt” is true and another if it’s not true. If it’s true, I want to change the costume to the red shirt costume. If it’s false, I will switch the costume to a blue shirt.

You need to think about when to check if “bought red shirt” is true. In my game, I will have them check it when they exit the shop. So every time they leave the shop, they’ll check if they should change their shirt color.

Let’s try that out! I will collect some coins, go to the shop, and buy the shirt. There you go! I now have the red shirt on. I used a red shirt as the example, but you can have something totally different in your shop. All you need to do is create a variable to keep track of whether the player bought that item and then have them do something different based on that.

In part two, I’ll show you how to add more features, like a speed boost that affects how fast the player moves, how to buy multiples of certain items, or make it so that the game only allows the player to buy an item once.

For now, I hope you enjoyed this tutorial, and I can’t wait to see all the shops you come up with! I’ll see you next time. Scratch on!

This version removes informal language and maintains a professional tone while preserving the instructional content.

ShopA place in a game where players can buy items or upgrades using virtual currency. – In the game, I went to the shop to buy a new sword for my character.

GameAn interactive program designed for entertainment, where players follow rules to achieve goals. – We created a simple game in class where you have to catch falling apples.

ButtonAn interactive element on a computer screen that you can click to perform an action. – I clicked the start button to begin playing the game.

SpritesImages or characters in a game that can move and interact with other elements. – We used different sprites to make our game more colorful and fun.

CoinsVirtual currency in a game that players can collect and use to buy items or upgrades. – I collected 100 coins to unlock a new level in the game.

ItemAn object in a game that players can use, collect, or interact with. – I found a magic item that gave my character extra strength.

BuyTo exchange virtual currency for items or upgrades in a game. – I decided to buy a new costume for my character using the coins I earned.

MessageA text or notification that appears on the screen to give information to the player. – A message popped up to tell me I had completed the level.

PlayerA person who interacts with a game, controlling characters or elements to achieve goals. – Each player takes turns rolling the dice in the board game.

CostumeA different appearance or outfit that a character in a game can wear. – I changed my character’s costume to make it look like a superhero.

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?