- Scratch Cookbook
- Brandon Milonovich
- 764字
- 2021-08-13 16:40:15
Changing the stage background
Once you've been programming in Scratch for a while, there is a good chance that you may need to change the background to something other than the default white color. Fortunately, Scratch makes this easy to do!
Getting ready
The area directly underneath the stage is where we select the sprite we are currently going to work on the programming for. You'll also notice that on the left side is an icon with a picture of the stage background (currently white if you haven't been straying from this chapter). This icon is labeled stage. Click on this.
If you've done anything in the script area with the sprite you had selected, you'll notice it is no longer visible in the script area. Whatever you do, don't worry. You have a different script area for each sprite as well as the stage.
Note
You might be wondering what we are going to do with the script area for the stage. We won't use this for a while until we get into more advanced programs, but the stage script area is great for programming actions that will occur in the background of your program. Sometimes you may not have a block of programming that isn't specific to a particular sprite. This is where you will put that block.
How to do it…
So let's get rid of that boring background! Follow along with these steps!
- In the stage script area, click on the second tab towards the top labelled Backdrops. You can import several backgrounds that you may later on want to access through programming blocks in your block palette. For now, let's just import a new one and delete the white background.
- Similar to how we imported new sprites in three different ways; you have towards the top of the Backdrops tab three different options for backgrounds. The second of these brings up the paint editor. If you didn't take the time to get used to the paint editor when making your own sprite this may be a great time to create a background. You can add any colors you want, shapes, or imported images.
Tip
Don't import a sprite when creating your own background. If you do, be careful. You may later on try to drag the sprite, thinking it's an actual sprite in your program. This will leave you confused (and possibly frustrated) when you can't get something to work.
- If you didn't go down the route of creating your own background, then you can choose the very common import button. Just like the sprite library, you have categories. The categories for your pre-made backgrounds are indoors, nature, outdoors, and sports. You also have an x-y grid you can use if you are getting into some fun with math.
Tip
Not happy with the backgrounds available? Don't want to make your own? The dialog box that comes up just points to the folder on your computer where Scratch has put these pre-made designs when it was installed. You can access your pictures on other parts of your computer just as you would in any other software package on your computer.
- The third option is to upload an image directly from your computer.
- The fourth option you have is to access your computer's webcam and take a picture. Clicking on the camera option will pop up the webcam of your computer. Click on the picture of the camera and you should see your webcam's image pop into the background!
- Once you've selected your new background, you'll see it added to the list of backgrounds available to program with. It should look something similar to the following screenshot:
There's more…
To delete the white background we won't need, click the small circle containing an x.
Note
Notice that you can edit or copy backgrounds. This gives you the functionality to customize backgrounds and make them your own. Also, notice that you can change the given name of a background (the default seen in the preceding screenshot is background1). As you build more complicated programs, it may be beneficial to give these names you'll recognize throughout the program. You might find it useful to do the same thing with your sprites; we'll bring this up again later though.
Now that you have a new sprite and a new background, we are ready to create our first program. We may not have a fancy game yet, but it's enough to get us acquainted with Scratch and ready for our next steps.
See also
- The Hello World project recipe in this chapter.
- Greenplum:從大數據戰略到實現
- Python數據挖掘:入門、進階與實用案例分析
- Spark快速大數據分析(第2版)
- Modern Programming: Object Oriented Programming and Best Practices
- 數據庫技術及應用教程
- Hands-On Mathematics for Deep Learning
- Proxmox VE超融合集群實踐真傳
- 辦公應用與計算思維案例教程
- 區塊鏈技術應用與實踐案例
- 智慧城市中的大數據分析技術
- Spring MVC Beginner’s Guide
- Access 2010數據庫程序設計實踐教程
- 利用Python進行數據分析(原書第2版)
- 數據應用工程:方法論與實踐
- 大數據測試技術:數據采集、分析與測試實踐(在線實驗+在線自測)