Planning Our Project:
Introduce the idea of a flowchart, a type of diagram that shows the sequence of steps involved in performing an
algorithm, with specific symbols used to represent different control structures. The symbols used in a flowchart are:
• Oval - used to show the beginning and end of the program
• Parallelogram - used to represent input or output
• Rectangle - used to show processing (i.e., calculating or
manipulating data)
• Diamond - used to show decisions (i.e., conditionals)
• Lines and arrows - used to connect the shapes to show the
direction of the steps and to represent loops
• Text and labels - included with shapes, as necessary.
Since every student’s project will be different, so will the flowcharts that they
create and the tools or technologies from which they can choose to create
their flowcharts (i.e., pen and paper, dedicated apps and websites for
creating flowcharts). A sample flowchart has been provided below to give a
general sense of what the end product may look like.
Creating Our Project:
The sample code demonstrate how the project might work and please note that the sprites representing the molecules
are exact duplicates, so the code is the same for each. For your reference, Scratch determines where to display sprites
and controls movement using a Cartesian coordinate system, with (0,0) being the center of the screen and it may be
helpful to pre-teach this concept, if it is one with which students are unfamiliar.
Part 1: Create the Membrane
1. Create a custom background using the Paint Editor to serve as the cell membrane. Using the rectangle tool or line
tool create a series of horizontal “dashes” precisely along the x-axis. There is a small symbol in the center of the
paint editor workspace that will help you line up your dashes. The gaps between each “dash” should be just large
enough that the molecule sprites will be able to fit through.
Part 2: Create the First Molecule
1. Create a sprite that is just a solid-coloured circle. You may wish to use the pre-designed Ball sprite already available
in Scratch and just change the costume to be a solid colour using the paint bucket tool.
2. Add a When Green Flag Clicked block and a Go To X () Y () block. Use a Pick Random () to () block in both the blank
spaces for the X and Y coordinates.
a. For the X value, set the parameters from -230 to 230. Since the coordinates required for the molecules to
stay on screen are -240 and 240, this provides a “buffer” to keep the molecules from starting right at the
edge of the screen. When more molecules are added, the random starting position will ensure that they
all start at different points on screen
b. For the Y value, set the parameters to -20 to -230. Assuming your membrane sprite from Part 1 was lined
up exactly along the x axis, the -20 will ensure that the molecules all start below the membrane. The value
of -230 provides a “buffer” from the edge of the screen and if you wish to have the molecules start at the
top of the screen, change these values to 20 and 230.
3. Add a Point in Direction () block. Use a Pick Random () block inside and set the parameters from 0 to 360. This will
randomly set the “heading” of each molecule so that the simulation begins with all of the molecules bouncing off
in different directions.
4. Add a Forever block and all blocks in the following steps will be inside of this block.
5. Add a Move () Steps block and set it to approximately 5. Increasing or decreasing this value will change the speed
at which the molecules appear to move.