Book Image

Scratch 2.0 Game Development Hotshot

Book Image

Scratch 2.0 Game Development Hotshot

Overview of this book

Table of Contents (18 chapters)
Scratch 2.0 Game Development HOTSHOT
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
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...