Part 3: Create the Variables
1. Create 4 new variables in the orange Variables menu, named: Force In, Force Out, Fulcrum Location, and Mechanical
Advantage, and deselect the checkbox next to the Force Out variable so it does not appear on screen.
2. Right click on the Force In and Fulcrum Location variables as they appear on the stage and change them both to a
sliding variable. The Mechanical Advantage variable should NOT be changed to a slider.
3. Right click on the Fulcrum Location variable again to change the slider range.
a. The range will need to be set depending on the length of the “lever” you created in Part 2.
b. You can click and drag the Fulcrum sprite to determine the coordinates of each end of the lever.
c. To make the simulation look more realistic, your Fulcrum Location variable should be set to 10 less than
the X coordinates of each end of the lever (i.e., in the sample code provided, the lever ends are at
approximately -180 and 180, so the Fulcrum Location slider range is set to -170 and 170).
Part 4: Set the Variable Values
1. In the stage, add a Forever loop under the Switch Backdrop To () block that should already be there from Part 1.
The next steps should all be inside of that loop.
2. To allow the fulcrum to move almost to the end of the lever (but not quite), as well as to compare the input and
output lengths of the lever to determine mechanical advantage, use a Set () to () block from the orange variables
menu and set the variable name to Mechanical Advantage.
a. In the blank space, add a () / () block.
b. In the first and second blank space of the () / () block, add () + () and a () – () blocks, respectively.
c. In the () + () block, add the block for the Fulcrum Location variable into the first blank space. Type the
number 175 in the second blank space.
d. In the () – () block, type the number 175 in the first blank space. Add the Fulcrum Location variable in the
second blank space.
e. You should end up with the statement: Set Mechanical Advantage to (Fulcrum Location) + 175 / 175 -
(Fulcrum Location)
f. The numbers 175 and -175 were used based on both the length of the level sprite in the sample code and
the fact that the Fulcrum Location variable has a maximum range of -170 and 170. You may need to adjust
these numbers based on the size of the sprites in your own project.
3. Use another Set () to () block from the orange variables menu and set the variable name to Force Out.
a. Inside the blank space add a () * () block
b. Add the block for the Mechanical Advantage variable in the first blank space.
c. Add the block for the Force In variable in the second blank space.
d. You should end up with the statement: Set Force Out to Mechanical Advantage & Force In
e. This section will determine the output force based on the input force chosen by the user with the variable
slider and the mechanical advantage calculated in the previous step.
Part 5: Program the Fulcrum
1. To make it so that changing the value of the Fulcrum Location variable, using the slider, will cause the actual fulcrum
sprite to move accordingly, add a When Green Flag Clicked block and place a Hide block underneath to ensure that
the sprite does not appear on screen during the title slide.
2. Add a When Backdrop Switches To () block and set it to the name of your blank backdrop.
3. Add a Show block and a Forever block.
4. Inside the Forever block, add a Go To X () Y () block.
a. Set the X coordinate to the Fulcrum Location variable.
b. Set the Y value to a coordinate that is underneath your lever sprite so that it still appears to be touching
the lever (i.e., in the sample code, this value is -100).