1 creating a game with scratch 2 0

Page 1

Erarmus+ Project: E-M@TI-ON

Sprites Each object in Scratch is called a sprite

Creating your first game in Scratch


Erarmus+ Project: E-M@TI-ON

Backdrops

You can: Choose backdrop from library Paint new backdrop Upload backdrop from file New backdrop from camera

For our game you should paint your backdrop Paint your backdrop

Note that you have other options for editing backdrops, which are: drawing on them, using the brush tool, lines or shapes adding text to them, with a variety of fonts available erasing parts of them selecting areas duplicating areas

Creating your first game in Scratch


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

1. Use line tool to draw the road

2. Use Fill with Color tool to add color to the road.

3. Delete the cat sprite


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

4. Choose a car sprite from Library

5. Make your car move: Open the Motion blocks and drag the move 10 steps block to your script.

6. Let's make the car moving forever. Open the Control blocks and drag the forever block to the script so it wraps around the motion block

7. Make your car move when Green Flag is clicked. Open the Events blocks and drag the When Green Flag clicked block to the script. Now click the green flag and you'll find that the car moves off the edge of the screen and disappears. f you click the flag again, nothing happens, as the sprite is already off the edge of the screen. Let's get it to go back to its starting point whenever the project is launched.

Defining the coordinates for a sprite 8. Resetting the sprites position: Go back to the Motion blocks and drag the go to x: y: block onto your script above the forever loop. Fill out the x and y coordinates x: -170 y: -50 Scratch determines where to display sprites through a coordinate system, or a mathematical grid of infinite values. It uses the Cartesian Coordinate System in which on a 2D plane, a point has two values to locate or reference its exact position.


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

9. The next step is when the car reaches the edge then it should be repositioned to x: -170 y: -50. Go to control blocks and add the if … then block to your script. Go to sensing blocks and add the touching to the if … then block. Then add the go to x: -170 y: -50 block in the if … then block.

10. Next let's make the car pause every ten steps, to slow things down and make it a bit more realistic. Open the Control blocks and drag the wait 1 secs block to your script, inside your forever loop and below the move block. Edit the wait 1 secs block.


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

11. Duplicate your sprite

12. Go to info to change the direction of the second car

13. Change rotation type and direction


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

14. Change the coordinates for the second car

15. Add a Crab sprite in your application 16. Shrink the Crab

Making a sprite move with arrow keys 17. Make your sprite move with the arrow keys. Open the Events blocks and drag four(4) When space key pressed block to the script. Change the keys in these blocks.

18. . Open the Motion blocks and drag the Move 10 steps block to your script.

19. Open the Motion blocks and drag the point in direction block to your script and define the direction.


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

20. Now the crab is moving with the arrow keys. If you want to change the way it moves change the attributes in the info tab of your sprite.

21. The crab has two different costumes, you can make the crab changing costumes while it us moving.


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

22. Open the Looks blocks and drag the next costume block to your script.

Add events 23. Add the following blocks to the crab’s script. Now the crab returns to a specific position when it touches one of the cars.

Adding variables 24. The next step is to take points when the crab goes to the other side of the road. First of all you have to identify in your game when the crab achieves the goal of the game. Go to your backdrop and change the color of the other side of the road. When the crab touching color “yellow” then the player should take points.


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

Add variables to your game 25. Open the Data blocks and drag, click Make a variable and give a name for it.


Erarmus+ Project: E-M@TI-ON

Creating your first game in Scratch

26. At the beginning of the game the points should be set to zero. Click the crab sprite. When the crab touches the yellow color then give one point to the player. Use blocks from Control, sensing and data blocks.

27. Problem!!! When the crab touches the yellow color then points

continuously increasing.

28. To avoid this problem make the crab return to it’s initial position when it reaches the yellow color.

29. Challenge: Add blocks to make the player to loses points when the crab touches a car.


Turn static files into dynamic content formats.

Create a flipbook
Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.