• Drag a “move [10] steps” block
into the workspace. Click on it
to see the sprite move a short
distance to the right
(Figure
M
)
.
• Put the “move [10] steps” block
inside a “forever” block from
Control (orange). Click on this
stack to make the cube move
across the whole stage. Notice
that the cube stops moving
when it hits the right edge of
the Stage.
8. To make the Cube sprite go back to
the beginning when it reaches the
end of the conveyor belt:
• Drag an “if-then-else” block
from Control inside the
“forever” block
(Figure
N
)
.
• Drag the “move” block inside the mouth below “else.” Change
the number of steps to 2. This will make it move slower.
• Go to the Sensing menu (light blue) and drag the pointy-
ended “touching [mouse-pointer]?” block inside the space
on the “if-then-else” block. Click on the little arrow next to
“mouse-pointer” and change it to “edge”
(Figure
O
)
.
• To make the Cube sprite jump back to the right spot:
• In the Motion menu, find the “go to x: [] y: []”
block — but don’t grab it yet
(Figure
P
)
.
• Go to the Stage, drag the Cube sprite to the beginning of
the conveyor belt, and drop it. Watch how the numbers on
the “go to” block change! (The numbers refer to the cube’s
location on an invisible grid. You can find any location by
looking at the x and y numbers of the square it’s on. To
see the grid, search for it in the Backdrops library.)
N
M
94
Making Simple Robots, 2nd Edition
Make_Simple_Robots_interior_FIN.indd 94Make_Simple_Robots_interior_FIN.indd 94 4/26/22 1:55 PM4/26/22 1:55 PM