2. Make your first game

Make your first game

We're going to make our first game on Scratch today! It will be a game where you have to catch as many figures as possible by clicking on them. The figures randomly appear on your screen. As always, you choose which figures you want in your game. For example, you may have to shoot down rockets or catch birds. You make your own game, but you have to go through all the steps below.

You learn to:

  • make a sprite appear / disappear in different places each time
  • add sounds from the Scratch library
  • insert a variable (score, time)

Register before you start the exercise. Click the button below and sign up.

click here

ORIENTATION

Take a look at the example and consider the following questions:

  • What should I do?
  • What are the goals?
  • What are the expectations?
  • What can I already do?
  • What do I still have to discover?

PREPARATION

View the steps at 'perform'. Then answer the following questions:

  • Which steps should I follow?
  • Which steps can I follow?
  • How much time do I need?
  • What tools do I need?

GO!

Do the steps one by one. Do you not remember how to do it? View the hints or download the solution.

STEP 1

Remove the cat (= sprite) from the playing field. Click with your right mouse button on the cat and click on delete (or click on the bin).

STEP 2

Add a new sprite from the library. Click on 'choose a sprite' and choose a sprite by clicking on it. Repeat these steps for the second sprite.

STEP 3

We need to create some code to make the sprite disappear when the green flag is clicked. After two seconds, the sprite should reappear, disappear after two seconds, and so on. So this has to be done over and over again! Do you have an idea how this code can be created?

Place the blocks below in the correct order:

4

Click on the green flag. What is happening?

 

STEP 4

You notice that you can click the sprite much too easily as it always appears in the same place ... We are going to do something about that! We add the block 'go to x: 0 y: 0' between 'wait 2 sec' and 'appear'. You will find this block in the 'movement' category.

Enter any two numbers between -240 and 240. What happens when you click on the green flag? Change the numbers again. What happens now?

It would be more fun if the sprite appeared randomly. Go to the 'functions' category and add the box 'random number between _ and _' to the blue box above.

7

Click on the green flag. What is happening?

STEP 5

We add a second line of code: when the player clicks on your sprite, it should disappear.

STEP 6

To make it all a bit cooler, we're going to play a sound as soon as you click on the sprite. Choose an appropriate sound for your sprite. To do this, go to the "sounds" tab and choose a short sound from the library.

10

Then pour this into the correct code.

 

STEP 7

The default white background is pretty boring. Choose a suitable background for your game yourself.

STEP 8

Of course you want to keep a score in your game! This can be done by creating a "variable" ("variable" means that it can change). At your "Code", click "Variables" and then "Create a variable".

STEP 9

Make sure the variable is 0 when you click the green flag. You will find the block 'set score by_' at ... Variables!

And then we still have to instruct your variable to increase by 1 every time you click on a sprite.

toelichting

Sometimes click on the button at the top right of your playing area to maximize it. This way you have a real playing experience!

20 

STEP 10

Our game aims to catch as many sprites as possible within a certain time. To do that you need to create a second variable that you call "time". Have you forgotten how to create a variable? Have a look at the step above.

The best part is when the time runs out and when the time runs out the game ends. We opt for 20 seconds, but of course you decide that yourself! The time should decrease from when the green flag is clicked. After 1 second, the time decreases by -1. The game ends when the time reaches 0.

Divide the sentence into steps and try to create the correct code.

REFLECTION

Look back at the project you just made. Ask yourself the following questions:

  • Does the program work as I expected? Why / why not?
  • What works well?
  • What works less well?
  • How can I approach it differently?

Download

Click the link below to download a sample solution.

 

Upload the project in the Scratch environment. Click the button below and follow the steps.

Click here