Sign In Start Free Trial
Account

Add to playlist

Create a Playlist

Modal Close icon
You need to login to use this feature.
  • Book Overview & Buying Scratch 2.0 Game Development Hotshot
  • Table Of Contents Toc
Scratch 2.0 Game Development Hotshot

Scratch 2.0 Game Development Hotshot

4.4 (14)
close
close
Scratch 2.0 Game Development Hotshot

Scratch 2.0 Game Development Hotshot

4.4 (14)

Overview of this book

Table of Contents (18 chapters)
close
close
Scratch 2.0 Game Development HOTSHOT
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
2
Index

Adding a second player


Driving around the circuit on your own is fun but not very challenging. It would be much better if you could invite a friend to compete against. In this step, we will introduce a second player character. Both characters will be visible on the same screen and will be controlled with one keyboard. We're effectively building a simple form of multiplayer.

Engage thrusters

To create a second player, we mainly have to copy the work we've done already. We need a second control sprite and a second kart sprite. We already added a Mario sprite to the game, so let's bring in his brother Luigi as the second player:

  1. Right-click on the control sprite named player1 and choose duplicate.

  2. The copy will be called player2 automatically. If that's not the case, change the name manually.

  3. Go to the player2 Scripts tab.

  4. Change the key pressed controls from a and d to left arrow and right arrow respectively.

The other script works exactly the same as for the player1 sprite.

Copying the sprite can...

CONTINUE READING
83
Tech Concepts
36
Programming languages
73
Tech Tools
Icon Unlimited access to the largest independent learning library in tech of over 8,000 expert-authored tech books and videos.
Icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Icon 50+ new titles added per month and exclusive early access to books as they are being written.
Scratch 2.0 Game Development Hotshot
notes
bookmark Notes and Bookmarks search Search in title playlist Add to playlist font-size Font size

Change the font size

margin-width Margin width

Change margin width

day-mode Day/Sepia/Night Modes

Change background colour

Close icon Search
Country selected

Close icon Your notes and bookmarks

Confirmation

Modal Close icon
claim successful

Buy this book with your credits?

Modal Close icon
Are you sure you want to buy this book with one of your credits?
Close
YES, BUY

Submit Your Feedback

Modal Close icon
Modal Close icon
Modal Close icon