Scratch

Scratch - Game design
We will be revisiting Scratch for making a game and to refresh your memory on how coding works.
1 / 24
next
Slide 1: Slide

This lesson contains 24 slides, with interactive quizzes and text slides.

Items in this lesson

Scratch - Game design
We will be revisiting Scratch for making a game and to refresh your memory on how coding works.

Slide 1 - Slide

How does this work...
  • You can use your arrow keys to navigate to the next slide.
  • If you come across a quiz you will click on the correct answer. If you are correct the answer will turn green.
  • On some of the pictures you can click to make them bigger.
  • If you come across a "?" in a circle you will have to click on it.
Example
Once you click on it you will see some extra information.

Slide 2 - Slide

The beginning
First we need to install
'Scratch 2'.

You can download it here.
(if you are working on a school computer you can skip this)

Slide 3 - Slide

Exploring
  • On the left you can find your animation preview.
  • In the center you can find the different coding elements.
  • On the right you build your code by dragging and dropping.
Take a look around and answer the questions on the next slide.

Slide 4 - Slide

In what category can you find the "forever..." loop?
A
Motion
B
Operators
C
Events
D
Control

Slide 5 - Quiz

Let's make a game!

Slide 6 - Slide

First we need to make our objects for our game
First we need to create our objects for the game.

Slide 7 - Slide

New objects
Sprites
Here you can delete and add new sprites. Start with deleting the cat by right clicking on it and clicking on delete.
After that you can create new sprites by clicking on the paint brush.
Drawing
Here you can draw your new objects. More about this on the next slide.
Shrink
It might be a bit hard to find the perfect size of your object but don't worry.
Above "Scripts","Costumes" and "Sounds" are 5 buttons, the one with the arrows pointing inwards is the shrink button. If you click on this and then on your object in the "preview screen" (top left) you can make it smaller.

Slide 8 - Slide

Center
Make sure you adjust the middle of the ball with the highlighted tool. First click on this blue button and then click on the middle of your ball.
Designing
To draw something you can use the different tools on the left side.
For the circle you hold down the 'shift' key when you are drawing it.
Filling with a color
If you want it to be filled with a color you will have to adjust that on the bottom of this screen, next to the colors.

Slide 9 - Slide

Preperation
First we need to make our objects that we will use:
  • 1 Ball
  • 1 Player (small rectangle)
  • 1 Red line behind the player that will count as a goal line

Slide 10 - Slide

If we wanted to make this a 2-player game, what do we need to add?
A
A ball, player and goal line
B
A ball and a goal line
C
A player and a goal line
D
A player and a ball

Slide 11 - Quiz

Step 1: The ball
Once we start our program the ball has to start moving (click on the ball to create a code for it).
  • To make sure it keeps moving we use the forever loop.
  • If we would want to play again the ball has to start in the center again.

Slide 12 - Slide

If we want the game to be more difficult and make the ball move faster, what do we need to change?
A
Higher amount of steps
B
Lower amount of steps
C
Higher x value
D
Lower x value

Slide 13 - Quiz

Step 2: moving the player

We click on our player to create a code for it to move.
  • We want him to move up if we press the "W" key.
  • We want him to move down if we press the "S" key

Slide 14 - Slide

Why are we not using the combination of "Point in direction 'up'" and "Move 10 steps"?
A
We can use it but it is longer
B
Because it is to complicated
C
Because our player will turn and be horizontal

Slide 15 - Quiz

Step 3: Bounce
If we would play the game now you would notice that the ball goes through the player.
  • Add a code to the ball that when it touches the player it turns around.

Slide 16 - Slide

Why are we making the ball point in the direction "90"?
A
90 = Up
B
90 = Right
C
90 = Down
D
90 = Left

Slide 17 - Quiz

Step 4: Random angle

Now the ball doesn't always make a perfect bounce and does a 180.
  • Make it so that when the ball touches the player he bounces in a random angle.
TIP: 0 = Up, 90 = Right,
        180/-180 = Down, -90 = Left

Slide 18 - Slide

If my player was on the right side, what would my random numbers be then?
A
20 & 160
B
-20 & 160
C
20 & -160
D
-20 & -160

Slide 19 - Quiz

Step 5: Game Over
One of the most important things that need to happen is that the game has to restart when the ball gets past you.
  • Add some code to your ball so that when the ball hits the red border the game waits 1 second and restarts.

Slide 20 - Slide

Step 6: Scoreboard
We want to keep track of the amount of times we touched the ball.
  • First we will need to make a new variable (look at the picture).
  • We want this to be 0 when we start or after we lost.
  • Every time we touch the ball it has to go up by 1.

Slide 21 - Slide

What would happen if we "change bounces by -1" instead of "by 1"?
A
Our score will go up when we touch the ball
B
Our score will go down when we touch the ball

Slide 22 - Quiz

Are you ready?
Try the following things.
In the same project:
1. Try to make a 2-player version of the game. (in the same project you worked on, player 2 uses arrow keys)
When you are ready with this you can test it out with a classmate.
Include a scoring system, when it touches the left goal line the right player gets 1 point.

Slide 23 - Slide

Are you ready?
Try the following things.
New projects (try on your own):
1. Make a game where you control a cat (can move left and right) and you need to keep the ball up, the ball can't touch the ground, if it does you lose.

2. Dodgeball: A ball keeps bouncing around, you control a character with the arrow keys (all directions) and if the ball touches you, you lose and everything stops.

Slide 24 - Slide