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!
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.
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.
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.
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.
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.
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.
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!
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.
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.
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.
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!
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.
Shop – A 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.
Game – An 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.
Button – An interactive element on a computer screen that you can click to perform an action. – I clicked the start button to begin playing the game.
Sprites – Images 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.
Coins – Virtual 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.
Item – An object in a game that players can use, collect, or interact with. – I found a magic item that gave my character extra strength.
Buy – To 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.
Message – A 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.
Player – A person who interacts with a game, controlling characters or elements to achieve goals. – Each player takes turns rolling the dice in the board game.
Costume – A 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.