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

Winning the game


Just one more thing to do to finish the game. At the moment, the enemies can win the game by destroying the base. But the player can't really win the game. There's no clear end state to kill all the enemies. To finish the game, we will determine fixed winning and losing conditions and add a game screen to clearly tell the player whether they have won or lost the game.

Prepare for lift off

Let's create the screen graphic first by following the given steps:

  1. Click on the paintbrush icon to create a new sprite.

  2. Choose a dark yellow color and draw a large rectangle.

  3. Click on Fill to fill the rectangle with a light yellow color.

  4. Select the Text tool and write the text YOU WIN! in the center of the rectangle.

  5. Duplicate the costume by selecting Duplicate.

  6. Edit the text in the second costume to read GAME OVER.

Engage thrusters

To show the game screen at the right moment and to display the proper costume, we will use a script as shown in the following steps:

  1. Click on the Scripts tab to add some...