Today you are coding in Scratch. You will build Shark Swim step by step at your device: a diver who swims a course, dodges a shark, and tries to reach the finish.
You can already move sprites and run a project. Today you will put movement, sensing and a win condition together into one chase game, and you will practise debugging when something does not behave as you expect.
Before you run anything, think: what do you expect to happen if the diver touches a wall or the shark?
Shark Swim has four parts:
Test each part on its own before adding the next.
Create a new Scratch project and delete the cat sprite.
Go to the Scratch website using the link below and click on the 'Create' link in the blue bar at the top.
By default, each new project starts with the cat sprite already added. To delete the cat click on the x in the blue circle beside the cat in the sprite list.
In the game a diver will swim through a course to try and reach the end without touching the edges or getting caught by the shark.
Paint a new backdrop with the following:
You can create your own backdrops using the backdrop editor. To create a new backdrop put your mouse over the Choose a Backdrop button and then click on the paintbrush.
This create a blank backdrop and will open the backdrop editor where you can use the tools to create your backdrop.
Add the Diver1 sprite from the sprite library and then drag it to the start of your swim course.
Once you've positioned it at the start, add the following code to set it up for the start of the game.
when green flag clicked
set size to (40) %
go to x (-173) y (-138) // x and y of the start of your course
go to x y block does, it makes the sprite go to the coordinates.To add a sprite from the sprite library follow these steps:
You can use search box or the filter links (Animals, People, Fantasy etc) to locate your sprite.
You're previewing this lesson. Get full access to this lesson and hundreds more — each one ready to teach, with interactive activities, printable resources and pupil progress tracking built in.