
MAKING FOUR
WALLS
We could just duplicate
this code four times
and do the appropriate
translating and rotating
for each one, but that
would leave us with a
lot of redundant code. It
would also mean that if
we want to make further
changes, like adding
windows, we would have
to be sure to add four
copies of that code, and keep them consistent with one another.
Instead, we will put the whole object inside yet another loop. To prepare our wall plus tower to rotate,
first we will translate this entire collective object (wall plus crenellations plus tower) away from the
center by wall/2 in the x and y directions. For x, we’ll need to move in the negati ...