Part 4: Sink Conditional
1. Add an If () Then conditional block and make sure that this block is inside of the Forever block from Part 3, Step 4.
a. Inside of the space to declare the condition, add a () > () block. Inside the first blank space of that block,
add a () / () block. There should now be 3 blank spaces to fill.
b. Add the Mass, Volume, and Density variable blocks to each of those 3 blank spaces, in this order.
c. The final statement for the condition should read as (Mass) / (Volume) > (Density).
2. Inside of the If () Then conditional block, add another If () Then conditional block (Nested-If).
a. Inside the space to declare the condition, add a Not () block
b. Inside the space for the Not () block, add a Touching Color ()? Block. It is very important that the exact
colour is correct; your eyes may not be able to tell subtle differences between colours, but your computer
can, so use the color dropper to select the exact shade used for the outline of the container sprite created
in Part 1.
3. Inside the second If () Then conditional block created in the previous step, add a Change Y by () block. Set the value
to -5. This will make it so that when the values for Mass, Density, and Volume should cause the object to sink, it will
only move down on the screen until it touches the outline of the container so that it does not “leak” outside the
container sprite.
Part 5: Float Conditional
1. Outside the two conditionals in Part 4 but still inside of the Forever block from Part 3, add another If () Then
conditional block.
a. Inside of the space to declare the condition, add a () < () block. Inside the first blank space of that block,
add a () / () block. There should now be 3 blank spaces to fill.
b. Add the Mass, Volume, and Density variable blocks to each of those 3 blank space, in this order.
c. The final statement for the condition should read as (Mass) / (Volume) < (Density).
2. Inside of the If () Then conditional block added in the previous step, add another If () Then conditional block (Nested-
If).
a. Inside the space to declare the condition, add a () < () block
b. Inside the first space for the () < () block, add the Y Position variable block. This will enable the conditional
to evaluate the current position of the sprite along the Y axis.
c. Inside the second space for the () < () block, write the Y coordinate at which point the object will have
reached the upper edge of the liquid you simulated in the container sprite. In the sample code provided,
this coordinate would be 0. Yours may differ depending on the size of your container sprite and where you
have positioned it on screen.
3. Inside the second If () Then conditional block created in the previous step, add a Change Y by () block. Set the value
to 5. This will make it so that when the values for Mass, Density, and Volume should cause the object to float, it will
only move up on the screen until it appears to reach the “surface” of the liquid
Extensions
● Add another variable to alter the type of liquid being represented on screen. In this example, the liquid
represented is water, which has a density of 1 g/cm
3
. How will this affect the behaviour of the item and whether
it will sink or float?
● Consider adding sound effects to the simulation using the pre-loaded sounds in Scratch or use the Sound Editor
to record their own sounds. The Start Sound () and Play Sound () Until Done blocks will allow students to insert
those files into their code.
● To learn more about fluids and buoyancy, consider the following books and videos:
o Buoyancy: What Makes Something Float or Sink? From Kids Want to Know
o Science Max - Volume, Mass and Density - Full Episode from TVOkids
o Density - Why does oil float on water? From It’s AumSum Time