Translation

Challenge Level: Ready to expand

Learning outcomes

Students will be able to:

Requirement:

Write a program that draws a cube with each sides equal to 50 steps. Translate the cube 6 times across to draw the image shown below.

A cube repeated 6 times across.

Testing examples:

There are no testing examples for this challenge.

Languages

Scratch

What it should look like

Click on the green flag to see the expected output of your program.

Recommended blocks
when green flag clicked
set [sides v] to [50]
clear

pen down

pen up

set pen size to (3)
go to x: (-180) y: (-50)

point in direction (0 v)

point in direction (90 v)

point in direction (180 v)

move (sides) steps

move (sides) steps

move (sides) steps

move (sides) steps

move (sides) steps

move (sides) steps

move (sides) steps

move (sides) steps

move ([sqrt v] of (((sides) * (sides)) + ((sides) * (sides)))) steps

turn cw (45) degrees

turn cw (45) degrees

turn cw ((180) - (45)) degrees

turn ccw (45) degrees

turn ccw (90) degrees

turn ccw ((180) - (45)) degrees

turn ccw ((180) - (90)) degrees
repeat (2)
end

repeat (6)
end
Hints
  • To translate a shape, every point of the shape must move the same distance in the same direction.
  • To draw the above image, translate the cube by the distance of the square’s diagonal, which is approximately 1.412 times the length of a side i.e. 70.71 if the side was 50 steps. (This is calculated using Pythagoras' theorem: )
    A diagonal cube.

Show Scratch solution