O'Reilly logo

Adventures in Coding by Chris Minnick, Eva Holland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

image

SO FAR, YOU’VE been using Scratch’s built-in blocks and they’re great, but Scratch also lets you make your own blocks that you can personalize and customize to your particular needs. In this adventure, you use custom blocks and a handy tool called the Backpack to put on a fashion show!

Making Your Own Blocks

If you can dream it up, you can probably create it by using Scratch’s built-in blocks. But, sometimes, your programs can get pretty complicated, with many different blocks all put together in a very precise way.

When that happens, a great way to stay organized and make programming easier is to create your own custom blocks.

Let’s take another look at the arrow key sprite control script that you created in Adventure 4, which is shown in Figure 9-1.

image

Figure 9-1 Basic arrow key controls

That’s a lot of blocks to just make a sprite move around when you press the arrow keys. Wouldn’t it be great if there were a block like the one shown in Figure 9-2 that you could use to do the same thing as all of the blocks ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required