Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Scratch 2.0 Game Development Hotshot

You're reading from   Scratch 2.0 Game Development Hotshot Get up to date with Scratch 2.0 and build brilliant games without having to code. Including 10 exciting projects that cover most game genres, you'll quickly learn the sophisticated possibilities of Scratch. Have fun!

Arrow left icon
Product type Paperback
Published in Feb 2014
Publisher
ISBN-13 9781849697569
Length 330 pages
Edition Edition
Tools
Arrow right icon
Toc

Table of Contents (18) Chapters Close

Scratch 2.0 Game Development HOTSHOT
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
1. Blowing Things Up! 2. Beating Back the Horde FREE CHAPTER 3. Start Your Engines 4. Space Age 5. Shoot 'Em Up 6. Building a Worthy Boss 7. Creating a Level Editor 8. Dungeon Crawl 9. Hunger Run 10. Sprites with Characters The New Scratch Interface Index

New script block categories


Scratch 1.4 contained eight distinct block categories. Scratch 2.0 contains ten. The new categories are called Events and More Blocks. Let's have a look at where these new categories come from and what they include.

Engage thrusters

The Events category doesn't contain anything new. It was split off from the Control category to better describe what the blocks contained within do. When we click on the Events category, we see that it contains most of the blocks with a curved top. These are the kinds of blocks a script always starts with. They are activated when something happens, or in other words, when an event occurs.

What's left in the Control category are loops and conditions. These are the logic blocks that can guide a script along different paths. They control what happens in the project and how it happens.

A new addition to the Control category is three blocks that are used to create clones of a sprite. This is a feature that was long missing from Scratch. A clone is a copy of a sprite that behaves the same as the original.

Perhaps you have seen projects with swarms of enemies. In the old version of Scratch, we had to manually copy each sprite. The Sprites view would quickly be filled up. This is no longer necessary. Now it's possible to create one basic enemy and then clone that enemy as many times as you want with a simple loop block. There can only be 300 clones on the Stage area at any given time, but in most cases, that will be plenty. Just keep in mind that any clones above the maximum amount won't be created.

The More Blocks category was introduced from a side project of Scratch. A group of students weren't satisfied with all the options Scratch had to offer already. They wanted to create their own function blocks. So they built an adapted version of Scratch called Build Your Own Blocks to include that feature. This feature has now been included in the main Scratch program. So now you can create your own blocks too.

The way this works is quite similar to how you create and use variables. First we click on the Make a Block button. Then we can give the new block a descriptive name. We can also include options. These add familiar slot spaces to the block. In this way, we can get variables and other data into the block.

When we are done with this step, a new purple define block appears in the Scripts editor. To this block, we can add more script actions, similar to how we create a regular script. You'll also notice that a purple block with our chosen block name has been added to the More Blocks category. This block can be put anywhere in any script to trigger the definition block.

This feature is very useful for a combination of actions that is repeated often. Instead of copying whole rows of blocks, we only need to include the self-built function block. The definition has to be written only once, but can be executed many times.

Objective complete – mini debriefing

The new block additions may seem small at first, but they can be very powerful tools to create more impressive projects. Both the cloning and the Make a Block option simplify the creation of hordes of enemies. Of course, they can be used for other purposes as well.

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image