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 popularplatform 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 atower and avoiding Donkey Kong’s barrels. In activity 2, you learned how computer scientistsuse events to tell a computer when to run code or complete an action. Donkey Kong usesevents to make actions happen in the game: When the user presses the right arrow, Mariomoves right. When the user presses the left arrow, Mariomoves left. When the user presses the space key, Mariojumps.
Donkey Kong also uses “if statements.” You used If statements when you built theMaze Game in activity 3 to instruct the computer to make decisions. If statements look likethis: IF a condition is true, then do this action.
In Donkey Kong: If Mario is not touching a platform, thenhe falls. If Mario touches a barrel, then he loses alife If Mario reaches the sprite, then user winsthe game. In your platform game, a sprite will jumponto platforms to reach another sprite. The game you’ll create is similar to DonkeyKong 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 touchinga platform, then it falls until it does. If the sprite reaches the sprite at the top ofthe platforms, then the user wins. To get started, open the starter project byclicking on the link on this page. Click remix, and sign in. If you don’t click remix orsign 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 willyour 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 andunique.
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 yourgame. For example, in this game the monkey needs to get to the bananas, so it makes senseto 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 gamewill 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 correctlyfor your game.