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

Creating and importing sprites


There are a few places in the Scratch editor where we can create or import images. If you used Scratch before, you will be familiar with them already. What has changed is that you can now draw images in two different ways. It's now possible to create sprites as bitmap images or as vector images. Each of these modes has some advantages and disadvantages.

Engage thrusters

As mentioned before, we can import images from the default library or from our local hard drive. We can do this for the Stage object while adding a new sprite, and also in the Costumes tab to add a new costume. You'll see that the same icons are repeated thrice in these three locations.

The more interesting addition is the toggle between Convert to bitmap and Vector Mode. You can find this button at the bottom right of the costumes editor, as shown in the following screenshot. What this does is it switches the created sprite between two different ways of drawing. It also changes how the image is calculated by the computer. This can make a difference to the performance speed while the project is running. Let's look at the differences between these two drawing modes.

Bitmap mode is what you will be accustomed to from the Scratch 1.4 program. In bitmap mode, sprites consist of pixels. Pixels are little squares that are placed side by side to form an image. An image like this is saved in the computer's memory as rows of pixels using the same color. For example, there are 10 transparent pixels, then two black pixels, then six orange pixels, and so on. The tools to create a bitmap image are similar to using a paintbrush on paper. Wherever you touch the paper with the brush, a clump of color is created. To create sharper graphics, the toolbox also has options to create (filled) rectangles and ellipses. It's also possible to erase parts of the image, pixel by pixel, if necessary.

Vector mode works quite differently. In vector mode, an image is described as curving lines. An enclosed space in between the lines is simply filled with a solid color. The curves and direction of the lines are saved in the computer's memory as math calculations. When an image is fairly simple, with relatively few complex curves, this can save a lot of memory compared to the saving of bitmap images. An advantage of vector images is that they can be reshaped by pushing and pulling the curved lines around. Another benefit is that vector images can be scaled up without a loss of quality. When bitmap images are scaled up, the pixels grow in size and you get to see the jagged edges. Vector images don't have that problem because the entire vector calculation is just multiplied to recreate the image in a bigger size.

When an image contains many different shapes or subtle color differences, like a photograph for instance, vector images don't work very well anymore. An image like that would contain so many curves and little color-filled shapes that the amount of calculations to save adds up. The resulting file would become bigger than a straightforward bitmap.

Objective complete – mini debriefing

Scratch still offers many ways to include images in your projects. There are even a few more options than before. You can get images from elsewhere, take a picture with your webcam, or draw your own images directly in Scratch. The new vector mode offers another way of drawing that can be useful at times. Just keep in mind what kind of an image you want to create, and experiment with both bitmap and vector images to see which one gives you the best result.

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