Scratch Arts
Advanced
45 mins
Teacher/Student led
+90 XP
What you need:
Chromebook/Laptop/PC or iPad/Tablet

Pattern Snake

Create stunning visual snake patterns by moving your mouse.

Lesson Files

Live Class Feed

This is a live feed of the latest activity by your students on this lesson. It will update in real-time as they work on the lesson.
Load previous activity

    1 - Create a new Scratch project

    Go to the Scratch website, create a new project and delete the cat sprite.

    scratch.mit.edu

    2 - Draw a sprite

    In this project we will draw a sprite and then code it to follow our mouse around the screen and create a trail behind it with some added effects.

    Create a new sprite and draw a shape. It can be any shape and any colour you like. Keep it small and drag it into the center of the box.


    3 - Follow you mouse pointer

    To make the snake pattern we will code the sprite to follow your mouse around the stage area.

    Add the following code to the sprite to make it start at a random position and then follow your mouse pointer.

    whenclickedgotorandom positionforevermove10stepsifonedge,bouncepointtowardsmouse-pointer

    Click on the green flag and your sprite should follow your mouse around.


    4 - Create clones

    To make the trailing snake effect we will create clones of our sprite, leave them where they were created and then delete them after 5 seconds.

    Add the following new code blocks to your sprite.

    whenclickedgotorandom positionforevermove10stepsifonedge,bouncepointtowardsmouse-pointercreatecloneofmyself add this blockwhenIstartasaclone add these blockswait5secondsdeletethisclone

    Click on the green flag and the clones should make a snake effect before deleting after 5 seconds.


    5 - Change the colour

    To make it look even better add a change [color] effect by 5  block underneath the create clone of [myself] block. This will change the color of the original sprite after each time a clone is created.

    whenclickedgotorandom positionforevermove10stepsifonedge,bouncepointtowardsmouse-pointercreatecloneofmyselfchangecoloreffectby5 add this block

    Click on the green flag and snake should me multicoloured now.


    Unlock the Full Learning Experience

    Get ready to embark on an incredible learning journey! Get access to this lesson and hundreds more in our Digital Skills Curriculum.

    Copyright Notice
    This lesson is copyright of Coding Ireland. Unauthorised use, copying or distribution is not allowed.

    Scratch is developed by the Lifelong Kindergarten Group at the MIT Media Lab. It is available for free at https://scratch.mit.edu
    🍪 Our website uses cookies to make your browsing experience better. By using our website you agree to our use of cookies. Learn more