Funny Trees

First Try

Some funny looking trees, if you can call them 'trees'

Build with for Loop

funnyTree

Use blocks: 'log_big_oak':22, 'leaves':8 A wood line in the middle, and two green leave lines at the left and right side.

# funnyTree
for j in range(20):
    block(0, j, -10, 22)
    block(-1, j+10, -10, 8)
    block(1, j+10, -10, 8)

Laugh!!

Let's try another: Cut the green lines short and also make separated green leave blocks

# 2DTree

for j in range(20):
    block(10, j, -10, 22)

    for l in range(10, 20, 2):
        block(9, l, -10, 8)
        block(11, l+1, -10, 8)

Keep laughing!

And keep trying: Put leave blocks at the front and back sides too

# 3DTree
for j in range(20):
    block(15, j, -10, 22)

    for l in range(10, 20, 2):
        block(14, l, -10, 8)
        block(16, l+1, -10, 8)
        block(15, l, -11, 8)
        block(15, l+1, -9, 8)

Second Try

We've defined some functions to build column and bar_y, let's try to use them to design trees.

Build a wood column in the middle as tree trunk, and add three green bars at the top.

# call column(x,z,h,m), bar_y(x,y,z,l,m)

#  tree2d, ever number h
def tree2d(x,z,h):
    column(x,z,h, 22)
    for i in range(x-1, x+2):
        bar_y(i,h,z,(h-2), 8)

tree2d(10,-10,10)

A 'tree' that looks more like a popsicle!

Let's make it 3D:

# tree3d
def tree3d(x,z,h):
    column(x,z,h, 22)
    for i in range(x-1, x+2):
        for k in range(z-1,z+2):
            bar_y(i,h,k,(h-2), 8)

tree3d(15,-10,10)

A thicker popsicle!

I agree, this lesson is just for laughing!

results matching ""

    No results matching ""