Skip to content

Please update your browser

Your browser version is not supported by this site. CS First may not work properly. Learn more

1. Ein Plattformspiel programmieren

Transcript

Welcome to activity 4 of Scratch Games! Today you will create a platform game.

In this type of game, a sprite moves across raised platforms or obstacles. Some popular platform games are Super Mario Brothers, Donkey Kong, and, more recently, Doodle Jump.

One of the earliest platform games, Donkey Kong, uses if statements and events.

In Donkey Kong, a character named Mario must rescue another character while climbing a tower and avoiding Donkey Kong’s barrels. In activity 2, you learned how computer scientists use events to tell a computer when to run code or complete an action. Donkey Kong uses events to make actions happen in the game: When the user presses the right arrow, Mario moves right. When the user presses the left arrow, Mario moves left. When the user presses the space key, Mario jumps.

Donkey Kong also uses “if statements.” You used If statements when you built the Maze Game in activity 3 to instruct the computer to make decisions. If statements look like this: IF a condition is true, then do this action.

In Donkey Kong: If Mario is not touching a platform, then he falls. If Mario touches a barrel, then he loses a life If Mario reaches the sprite, then user wins the game. In your platform game, a sprite will jump onto platforms to reach another sprite. The game you’ll create is similar to Donkey Kong and uses the same types of events and “if” statements in the code.

In this game, the sprite moves when the arrow keys are pressed. If the sprite is not touching a platform, then it falls until it does. If the sprite reaches the sprite at the top of the platforms, then the user wins. To get started, open the starter project by clicking on the link on this page. Click remix, and sign in. If you don’t click remix or sign in, your work won’t be saved, so make sure you complete this step.

Next, add two sprites to your project.

Click “choose new sprite” from library, and choose a goal sprite. What object will your main character need to reach?

Then, click “choose new sprite” and select a main character for your game.

There are many different combinations of sprites that you can use to make your game fun and unique.

The example project will use a monkey and bananas.

After you choose sprites, arrange them on the screen in a way that makes sense for your game. For example, in this game the monkey needs to get to the bananas, so it makes sense to drag the monkey to the bottom of the screen and drag the bananas to the top platform.

To change the sprites’ sizes, choose either the “shrink” tool or the “grow” tool, and click on the sprite. When you’re done setting up how your game will look, return to this screen and click the green arrow to move on to the next video.

Now, it’s your turn: 1) Open the platform starter project.

2) Click remix, and sign in. 3) Add two sprites, and position them correctly for your game.

Weiter arrow_forward
Anweisungen
  1. Öffnet das Startprojekt auf der CS First-Seite.
  2. Klickt auf „Remixen“ und meldet euch bei Scratch an.
  3. Ordnet die Figuren auf dem Bild in einer für euer Spiel sinnvollen Anordnung an.