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

Finishing the game


Two players can now race each other around the circuit, which is already a lot of fun. But it would be even better if the game has a clear end state and a notification about who won the game.

Engage thrusters

We will add some more scripts to the control sprites player1 and player2. We will first build one complete instruction set, which we can then easily copy to the second sprite.

To determine whether a player has completed a round, we need to add a finish line. This can be a simple additional sprite laid across the track:

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

  2. Select the Line tool and draw a horizontal line. Make sure that the line is wide enough to stretch across the road and the sandy areas next to it.

  3. Drag the line to the position of the finish line on the backdrop image.

  4. Name the new sprite finish.

  5. Go to the Scripts tab of the finish sprite.

  6. Add a when <green flag> clicked block.

  7. Attach a set <ghost> effect to () block to make the line invisible;...