Create a spiral
This challenge has been written by Lydie El-Halougi and is part of the EU CODE WEEK CHALLENGES.
Target Audience
- Primary School students (6 to 12 years)
- Lower Secondary School students (12 to 16 years)
Experience
- Intermediate
Duration
- 1 hour
Purpose
- To learn and practice loop and variables.
- To enhance creativity in coding.
Recommended Materials
Description
In this challenge you will write a project with Scratch to create a spiral, using the pen blocks, a loop and a variable.
Instructions
- Create a new project and name it Spiral.
- Click on the purple icon “Add extension” on the bottom-left side of the window
- Select “pen”: the pen blocks are now available for your project!
- To start your project, drag and drop the “when green flag clicked” block:
- You need to start with a blank page: within the pen blocks, add the “erase all” block:
- You want to start drawing at the center of the stage, which means your sprite has to go to the center of the stage (0,0):
- Your sprite can move without drawing, or move and draw:
- when you want it to draw, you can use the pen down block
- when you don’t want that, you can use the pen up block
- Now, you want to draw! Add the “pen down” block:
- Add the blocks below to your project:
- You now have one sixth of your hexagon. You need to repeat this sequence 6 times:
- To create a spiral, you’ll need to add 2 to the length of each next side.
- To do so, you will use a variable.
- In the variable blocks, click on Make a Variable
- Name it length, then click OK:
- The spiral is going to grow, you’ll need to start small: set the first length to 10, and insert this block before the loop.
- Insert the variable “length” in the “move … steps” block
- To have the spiral grow, you also need to have the length grow in every loop: add the block below at the end of the loop:
- Here is your current project:
- You drew a spiral! For it to go on and on, replace the “repeat 6” loop with the “forever” loop:
- To draw a colorful spiral, add the following block in the loop:
- When you start over, the sprite draws an unwanted line. To prevent it, add a “pen up” block at the beginning of the project.
- Here’s your final project: Congratulations! You created a lovely spiral!
The Pen blocks
The hexagon
The spiral
A beautiful spiral
Share the link to your work in your Instagram Bio: tap the Edit Profile button on your Instagram and add the link to your work in the Website field. After that, create a new post, add a screenshot of your work, write “Link in Bio”, add the hashtag #EUCodeWeekChallenge and mention @CodeWeekEU.
Example
Click here to download this challenge as a word document.
Copyright notice ©
The EU Code Week website for schools is a service supported by the European Commission
Except where stated otherwise, content made available on this site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license
Licensing under Creative Commons licenses does not of itself affect the ownership of the copyright
Content from third party websites is subject to their own copyright restrictions; please refer to the site of origin for more information.
The EU Code Week website for schools is a service supported by the European Commission
Except where stated otherwise, content made available on this site is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) license
Licensing under Creative Commons licenses does not of itself affect the ownership of the copyright
Content from third party websites is subject to their own copyright restrictions; please refer to the site of origin for more information.