Scratch Code Shark Attack Game
Green highlight

Design and code a Shark Attack game in Scratch, creating sprites, movement, collision detection, and scoring while learning programming logic and debugging.

Orange shooting star
Start Creating
Background blob
Challenge Image
Skill Badge
Table of contents

Step-by-step guide to design and code the Scratch Shark Attack game

What you need
Adult supervision required, scratch account or scratch offline editor

Step 1

Open Scratch and click "Create" to start a brand new project so you have a blank game to build.

Step 2

Delete the cat sprite and add or paint a Shark sprite to be the player so you have a character to control.

Step 3

Add a Fish sprite to collect and make at least one costume variation so you have things for the shark to eat.

Step 4

Add a Big Shark or Hazard sprite to act as an enemy that will make the player lose lives.

Step 5

Choose or paint an Ocean backdrop and make a separate Start backdrop so your game looks like the sea and has a starting screen.

Step 6

Create two variables named Score and Lives for all sprites and set them to 0 and 3 respectively so you can track points and health.

Step 7

Add movement code to the Shark using blocks like "when green flag clicked" then "forever" with "if key pressed" blocks to move the shark with the arrow keys so the player can swim around.

Step 8

On the Fish sprite add code to hide the original then forever wait a random time then create clone of myself and set clone position to the right edge so fish appear over time.

Step 9

Add code to each Fish clone so it moves left across the screen and deletes itself when it goes off the left edge so fish travel across the ocean.

Step 10

Add collision code to each Fish clone so when it touches the Shark it changes Score by 1 plays a munch sound and then deletes the clone so eating gives points.

Step 11

Add spawning and movement to the Big Shark hazard using clones and random intervals so danger moves through the ocean like an enemy.

Step 12

Add collision code so when the Shark touches the Big Shark it changes Lives by -1 and briefly shows a flash or sound so lives go down on hits.

Step 13

Add game-over logic that checks "if Lives = 0" then broadcast "game over" and switch to the Game Over backdrop to stop the game when the player runs out of lives.

Step 14

Playtest your game and fix one bug at a time until it works smoothly then polish with sounds and costume tweaks so your game is fun and bug-free.

Step 15

Share your finished Shark Attack game on DIY.org so everyone can see and try your awesome creation.

Final steps

You're almost there! Complete all the steps, bring your creation to life, post it, and conquer the challenge!

Complete & Share
Challenge badge placeholder
Challenge badge

Help!?

What can I use if I can't find or paint a Shark sprite?

If you can't find or paint a Shark sprite, delete the cat sprite and choose any sea sprite (like a dolphin or a fish) or draw a simple shape and rename it 'Shark' so the movement and collision scripts still work.

My Score doesn't change when the shark eats a fish — what should I check?

Check the Fish clone's code so under 'when I start as a clone' it moves left and that the collision block reads 'if touching Shark then change Score by 1 play sound munch delete this clone' and that your player sprite is actually named 'Shark'.

How can I adapt this game for younger or older kids?

For younger kids remove or reduce the Big Shark hazard, set Lives to 5 and slow fish spawn times, while for older kids increase Big Shark clone frequency, speed up fish movement, and add a Level or Timer variable for extra challenge.

How can I extend or personalize the game after it's working?

Add a PowerUp sprite that creates clones which, when touching the Shark, broadcast 'invincible' or change Score by more, customize the Ocean and Start backdrops and sounds, and polish costumes before sharing on DIY.org.

Watch videos on how to design and code the Scratch Shark Attack game

0:00/0:00

Here at SafeTube, we're on a mission to create a safer and more delightful internet. 😊

Scratch Programming - Shark Attack Game 1

4 Videos

Facts about block-based coding and game design

💥 One common beginner collision method is a simple bounding-box check (do the rectangles overlap?), which works great in Scratch.

🧩 Scratch has a huge community—kids and teachers around the world have shared millions of projects on the Scratch website!

🔢 Scratch uses variables and broadcasts so young coders can track score, lives, timers, and game events without typing text-based code.

🎮 The term “sprite” comes from early computer graphics and refers to the 2D images used to represent characters and objects in many games.

🦈 There are over 500 known species of sharks, from tiny lanternsharks to the giant whale shark.

How do I create a Shark Attack game in Scratch?

To build a Shark Attack game, plan the rules first: player controls, goals, and hazards. In Scratch, add sprites for the shark, fish and background. Use motion blocks for player movement (arrow keys or mouse) and create scripts to spawn enemies or fish. Detect collisions with “if touching” blocks to subtract lives or add points. Use variables for score and lives, add sounds and a game-over backdrop, and test frequently to debug and refine behavior.

What materials do I need to make a Scratch Shark Attack game?

You need a computer or tablet with internet and a Scratch account (free at scratch.mit.edu), plus a keyboard and mouse or touchscreen. Optional but helpful: headphones for sound testing, a notebook or sketchpad for planning levels and sprites, and a parent/teacher for younger kids. No special hardware or software is required beyond a web browser and basic familiarity with Scratch’s drag-and-drop coding blocks.

What ages is the Scratch Shark Attack game suitable for?

Scratch is ideal for children roughly aged 8–14. Younger kids (6–7) can participate with adult guidance, while older kids can add more complex logic. This activity scales: beginners learn movement and collision, intermediate students use variables and cloning, and older kids implement scores, levels, and debugging strategies. Supervision is recommended for internet use and to support problem-solving as projects grow in complexity.

What are the benefits of making a Shark Attack game in Scratch?

Making this game teaches programming basics like sequencing, conditionals, variables, and event-driven logic, plus debugging and iterative design. It builds problem-solving, creativity, and persistence as kids test and fix behaviors. The project also strengthens math skills (timing, coordinates) and can encourage collaboration if kids share or remix projects. It’s a low-pressure way to learn computational thinking while producing a fun, playable result.
DIY Yeti Character
Join Frame
Flying Text Box

One subscription, many ways to play and learn.

Try for free

Only $6.99 after trial. No credit card required