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 a new project


We need to make sure that we're logged in and ready to get to work on a new project. We'll then draw some sprites and assemble our awesome cannon (and cannonballs). The Scratch menu bar gives us the option to explore the existing projects from other users (using Explore) or create a new project ourselves (using Create):

Prepare for lift off

You are presented with a new project, including the Scratch cat as usual. We won't use the cat, so you can right-click on the sprite, and choose delete. A sprite is the official name for a 2D computer image. Most Scratch projects are built using sprites. You can find an overview of all the sprites used in a project in the bottom-left corner of the screen, underneath the stage.

Engage thrusters

We will draw our own sprites for this game. Let's start with a simple cannonball!

The cannonball will be the main actor in this game because it will be the object that "blows things up". There are a few ways to add a new sprite to the stage. We can draw a sprite, select a sprite from the Scratch library, or import it from our hard drive. It's also possible to take a picture with a webcam.

To draw sprites, we perform the following steps:

  1. Click on the little paintbrush icon between the stage and the sprites window. This will open the costumes tab.

  2. Check if the editor is in Bitmap Mode or in Vector Mode. To create our drawing, we will select Vector Mode.

  3. Select the Ellipse tool (the circle) seen on the right-hand side of the drawing canvas. Click and hold the left mouse button and drag it. You will probably end up with something that's not quite a circle.

  4. Undo your drawing with the back arrow button at the top of the drawing canvas. When things go wrong, you can always go a few steps back. You can even clear the entire screen (using Clear) and start over.

  5. To create a perfect circle, hold Shift while dragging the mouse. Don't make your circle too big. It has to be able to move about the stage freely without bumping into the edges all the time.

  6. Next, click on the crosshair button at the bottom of the toolbar. This button lets you center your image. Now click on the center of your cannonball.

  7. We name the new sprite cannonball.

Your cannonball is now done and ready for business. It will look like a simple grey dot as in this screenshot:

Let's move on to creating a cannon to shoot from. The cannon will consist of two parts: the back of the cannon, which serves as the pivot point, and the barrel. The following are the steps to create them:

  1. Create a new sprite by clicking on the paintbrush icon.

  2. Start again by creating a circle. This circle should be slightly larger than your cannonball.

  3. Next, select the Rectangle tool that is right above the Ellipse tool.

  4. Draw a rectangle that is as high as the circle but about three times as wide.

  5. Click on the Select tool and drag the rectangle to overlap the right half of the circle.

  6. Make sure that the center point of the cannon is placed at the center of the circular element, near the back of the cannon.

  7. We name this sprite cannon.

  8. Just keep in mind that the cannon consists of two separate shapes. You can color them separately, or you can color them together by first selecting both the shapes while holding the Shift key.

Objective complete – mini debriefing

We've now got ourselves a cannon and some ammunition to shoot with.

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