"How to Make a Shark Catching Game in Tynker – Easy Step-by-Step Tutorial for Kids"




Yellow Fish Code Breakdown:


Underwater Shark Game – Project Explanation

This is a fun Scratch-style chasing game where a shark follows the mouse and eats spawning fish to increase the score. Below is a clear, structured explanation of how your project works.


 Sprites in Your Project

You used 3 main elements:

  1. Stage – Underwater background

  2. Yellow Fish – Food that keeps spawning

  3. Shark 011 – Player-controlled shark


 Yellow Fish – Code Explanation

🟢 When Green Flag Clicked (Main Script)

  • Set Score = 0

  • Hide the original fish

  • Set size to 30%

  • Start a forever loop

Inside the loop:

  • Go to x: -230 (left side of screen)

  • Set y to random (-180 to 180) → fish spawns at random heights

  • Create a clone

  • Wait 1 second

  • Switch costume (adds animation effect)

 Result: A new fish appears every second from random positions on the left side.


 When I Start as a Clone

Each clone:

  • Becomes visible

  • Points in direction 90° (right)

  • Sets rotation style to left-right

  • Enters a forever loop

Inside that loop:

  • Turn random (-10 to 10 degrees) → makes movement natural

  • Move 5 steps

  • Bounce if on edge

  • Check collision with Shark


 When Fish Touches Shark

If touching Shark 011:

  • Increase Score by 1

  • Play "Chomp" sound

  • Broadcast message "Food"

  • Hide (fish disappears)

 This creates the “eating” effect.


 Shark 011 – Code Explanation

When Green Flag Clicked

  • Switch costume to "Shark 13"

  • Set size to 100%

  • Enter a forever loop

Inside loop:

  • Point toward mouse pointer

  • Set rotation style to left-right

  • If distance to mouse > 10:

    • Move 10 steps toward mouse

 Result: Shark smoothly follows your cursor.


 When I Receive "Food"

This is the eating animation.

Repeat 3 times:

  • Switch to costume "Shark 08"

  • Wait 0.1 seconds

  • Switch to costume "Shark 12"

  • Wait 0.1 seconds

  • Change color effect by 25

After loop:

  • Clear graphic effects

 This creates:

  • Mouth opening & closing animation

  • Flashing effect

  • Visual feedback of eating


 How Everything Works Together

  1. Fish continuously spawn from the left.

  2. Shark follows the mouse.

  3. When shark touches a fish:

    • Score increases

    • Fish disappears

    • Shark performs eating animation

  4. Game runs endlessly.


Game Logic Summary

ElementFunction
FishSpawns, moves randomly, detects collision
SharkFollows mouse, plays animation
Broadcast "Food"Connects fish collision to shark animation
Score VariableTracks points

 Why This Is a Good Game Design

✅ Uses Cloning (advanced Scratch concept)
✅ Uses Broadcast Messages
✅ Includes Collision Detection
✅ Has Animation Effects
✅ Infinite Gameplay Loop
✅ Clean Sprite Communication


 Possible Improvements

You can upgrade the game by adding:

  •  Timer (Game Over after 60 seconds)

  •  Lives system

  •  Enemy fish that reduce score

  •  Background ocean sound

  •  High score saving

  •  Speed increase over time

  •  Bubble particle effects





Comments

try for free