Sie sind auf Seite 1von 12

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.

`
Next: Program your Character so it can move

Code for moving left


4
Drag and drop this code
from the scripts tab
into your Character
sprite workspace (the
open grey area) Code for moving right

5
Click the green arrow to play-test your code, if the character doesn’t move
left and right, double check your code.

`
Next: Design a cool background and deadly area

6
Click on the “paint new
backdrop” button.

7
Draw or import a cool
background for your level!

8 Use the draw


rectangle button

Draw a rectangle of any color at the bottom

9 of the level to be your deadly zone.

`
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

This code makes your

13 sprite jump with spacebar

Click on your
character sprite, then
scripts, and add this
code to your
character sprite.

This simulates

14 gravity

Test your game! See if


everything works so far!
Then press stop!

15
Add this code to your character
sprite to make it go back to the
beginning when it touches the
deadly zone!

T
The color here has to be the same
` color as your deadly zone.
Next: Design your level and moving platforms

16
Click on the paint new sprite
button, or duplicate your old
platform sprite (right click
and duplicate).

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 d

To make your
game a little
harder, choose a
platform or 2 and
add this code to Pro Tip: the “repeat” numbers
change how far the platform
get them to moves and “change x by” numbers
move change how fast it moves

`
Next: Add a goal, and create variables
r

19
Click on the paint new
sprite button and
draw a goal portal

20 Click on scripts,
then data,
then Make a Variable.

21 Then make 2 variables,


one called Lives, and
another called Timer.

`
Next: program your goal and limited lives

22
Add this code to your goal
sprite to make you win.

23
If you want to have
limited lives, add these
two bits of code to your
character sprite’s
jumping function.

`
Next: Finish lives and add game over screen

Also you need to To this:


24 change deadly zone
code in your character
sprite from this:

Now, let’s make a

25 Game-Over
backdrop if you
lose all your lives.

Click on paint new


backdrop, and
make a game over
screen.
This makes the
Next, click on scripts game reset to the
first backdrop
and put these two bits
of code under your This makes the
Game-Over screen
backdrop’s scripts appear
`
Finally: Test, and add finishing touches.

Test your game, make sure you can win or lose,

26 and that it is not impossibly hard, or too easy.

27 If everything works… Congratulations!


You finished the basic game!

Bonus: Now you can customize your game and add


28 extras like a custom sound track.

Upload a song you


made using Beepbox
and add this code to
your Character sprite.

`
Bonus continued:

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

Das könnte Ihnen auch gefallen