Bigger Tree
A real tree is likely to have more leaves. So let's make a function tree(x, z, h, w)
, where the (x, z)
is the ground location, h
is the height, and w
is width of tree head on one side.
def tree(x, z, h, w):
# w is width of tree head on one side
column(x, z, h, 'log_big_oak')
for i in range(x-w, x+w+1):
for k in range(z-w, z+w+1):
Y_tree_line(i, (int(h/2)+2), k, int(h/2), 'leaves_oak')
tree(40, -10, 15, 3)
A new tree at the right:
Colorful trees
Can you modify the code to use a different material for leaves? Here are a few examples:
We have some trees, are you ready for a forest?