Introduction to Scratch & Coding

Introduction

Create a glowing, colorful trail that follows your mouse pointer using clones.

Making a Sprite Follow the Mouse

Use a glowing star sprite.

Coding:

  • Events → when green flag clicked
  • Control → forever
  • Motion → go to mouse pointer

→ Sprite now follows the cursor.

Creating the Trail

Using Clones

  • Inside forever → add create clone of myself
  • The trail appears, but too many clones make it messy

Limit the Clones

  • Events → when I start as a clone
  • Control → repeat 10
  • Inside loop:
    • Looks → change color effect
    • Looks → change size
  • After loop → delete this clone

→ This creates a smooth, glowing trail.

Making a Snake-Like Trail for a Ball

  • Add a ball sprite
  • Make it create clones too
  • Add change ghost effect by 10 to make it fade

→ Gives a smooth, snake-like motion.

Adding an Enemy (Dragonfly)

  • Add dragonfly sprite
  • Motion → glide (time) to random position
  • Put inside forever loop

→ Dragonfly moves unpredictably.

Game Condition

If the glowing trail (ball clone) touches the dragonfly, the game ends:

  • Control → if then
  • Sensing → touching (ball)?
  • Control → stop all

What Students Learned

  • Cloning
  • Ghost effect
  • Color effect
  • Size change animation
  • Random movement
  • Collision detection
  • Making mini-games

Assignment

Create one of the following:

  • A magical fairy dust trail
  • A line of birds flying in random directions
  • A game where characters follow the main sprite