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

Creating a player character


The most important part of this game is the player character. This is the direct representation of the player in the game. The player can control the character and move it around. The player has to protect the character from harm to win the game.

Prepare for lift off

We will look for an interesting sprite in the Scratch library to use as the player character. The diver looks like an interesting choice since he is lying horizontally and facing right.

A perfect start for a side-scrolling game! The diver can be found in the People or Underwater category. There are two diver sprites. I choose the orange one, because it stands out better against a blue, watery background.

Engage thrusters

After adding the diver sprite to the stage, we can start scripting the player controls. This is a fairly straightforward process, as follows:

  1. Start with a when <green flag> clicked block.

  2. Scale the sprite down with a set size to ()% block; enter the value 30.

  3. Then, reposition it to...