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

Adding scores and power-ups


To prepare for the upcoming boss battle (next project), it's a nice touch to power up the player character. A power-up system also offers a better reason for shooting enemies apart from the need for survival.

Engage thrusters

We will assign a score value to each enemy type. The player can increase the score by shooting the enemy of the corresponding type. When the player has defeated enough enemies, the spear will be powered up in some way.

  1. We have three different enemy types, so we will first create the following three new variables to hold the scores. These variables are available for all sprites.

    • scoreRed

    • scoreBlue

    • scoreYellow

  2. Click on the checkboxes in front of the new variables to make them visible on the stage. This way we can keep track of our scores.

  3. At the start of the game, we set the values of these variables to 0 as shown in the following screenshot. The best place to do this is inside the stage object.

  4. Next, we will add a point to the correct variable...

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