`
Step by Step Scratch Tutorial –
Make a Platformer Game
Create a sprite and level for a platformer style game
Bonus: add lives, extra levels
Programming difficulty: medium
`
First: Create your character Sprite, or import from file.
1 Open Scratch and
Delete the cat
(right click, delete)
2 Click the new button (or click import from file if you
made a custom spaceship)
3 Choose a sprite to be
your character.
Then click OK.
`
4 Drag and drop this code
from the scripts tab
into your Character
sprite workspace (the
open grey area)
Next: Program your Character so it can move
5 Click the green arrow to play-test your code, if the character doesn’t move
left and right, double check your code.
Code for moving left
Code for moving right
`
Next: Design a cool background and deadly area
7 Draw or import a cool
background for your level!
8 Use the draw
rectangle button
9 Draw a rectangle of any color at the bottom
of the level to be your deadly zone.
6 Click on the “paint new
backdrop” button.
`
Next: Make some platform sprites
10 Click the Draw new sprite
button
11 Click magnifier and zoom to
200%, then draw a small
platform. (use a different color
than your deadly zone)
12 Drag your platform to
where you want it in your
level, and make it bigger or
smaller by clicking enlarge
or shrink, and then clicking
your platform.
`
Next: Make your character jump and fall with gravity
13 Click on your
character sprite, then
scripts, and add this
code to your
character sprite.
15 Add this code to your character
sprite to make it go back to the
beginning when it touches the
deadly zone!
T
14 Test your game! See if
everything works so far!
This code makes your
sprite jump with spacebar
This simulates
gravity
The color here has to be the same
color as your deadly zone.
Then press stop!
`
d
16 Click on the paint new sprite
button, or duplicate your old
platform sprite (right click
and duplicate).
Next: Design your level and moving platforms
17 Make a bunch of different platforms, place them in
your level, and then play test your game to see if it
has a good difficulty.
18 To make your
game a little
harder, choose a
platform or 2 and
add this code to
get them to
move
Pro Tip: the “repeat” numbers
change how far the platform
moves and “change x by” numbers
change how fast it moves
`
r
19 Click on the paint new
sprite button and
draw a goal portal
Next: Add a goal, and create variables
20 Click on scripts,
then data,
then Make a Variable.
21 Then make 2 variables,
one called Lives, and
another called Timer.
`
22
23 If you want to have
limited lives, add these
two bits of code to your
character sprite’s
jumping function.
Next: program your goal and limited lives
Add this code to your goal
sprite to make you win.
`
24 Also you need to
change deadly zone
code in your character
sprite from this:
To this:
Next: Finish lives and add game over screen
Now, let’s make a
Game-Over
backdrop if you
lose all your lives.
25
Click on paint new
backdrop, and
make a game over
screen.
Next, click on scripts
and put these two bits
of code under your
backdrop’s scripts
This makes the
game reset to the
first backdrop
This makes the
Game-Over screen
appear
`
Finally: Test, and add finishing touches.
26 Test your game, make sure you can win or lose,
and that it is not impossibly hard, or too easy.
27 If everything works… Congratulations!
You finished the basic game!
28 Bonus: Now you can customize your game and add
extras like a custom sound track.
Upload a song you
made using Beepbox
and add this code to
your Character sprite.
`
29 Bonus: Other ways to customize your game may be,
adding moving obstacles like a fireball, adding a game-
over sound, or adding more levels. Try to figure it out!
X-D
Bonus continued:
Top Related