Code

Doors

18-01, Function doorFrame(x,z,m)

# doorFrame, height 10, width 5
def doorFrame(x,z,m):
   column(x,z,10,m)
   column(x+5, z,10,m)
   bar_x(x, 10 z, 5, m)

18-02, Glass door

The process is: On a stone wall, build a piece of 'glass' panel, around the glass panel build a door frame.

# useful functions: wall(x,z,h,w,m), doorFrame(x,z,m)
wall(0,-10,40,40, 'cobblestone')       # a stone wall

wall(6,-10, 10, 5, 'diamond")          # can also use 'glass_blue'

doorFrame(5, -10, 'planks_oak')         # oak frame

18-03, Function door(x,z,m)

def door(x,z,m):
  materials['air'] = 0         # add `air` to `materials`

  wall(x,z, 10, 5, 'air')      # make 'air' panel inside door frame

  doorFrame(x,z,m)
  doorFrame(x,z+1,m)


# build a door
door(28,-10, 'box_red')       # a red double frame door

Windows

18-04, Simple windows

# Function simpleFrame()
def simpleFrame(x,y,z,h,w,m):
  bar_x(x,y,z,w,m)
  bar_x(x, y+h,z,w,m)
  bar_y(x,y,z,h, m)
  bar_y(x+w, y,z, h+1, m)

# green window
wall(0,-20, 30,30,'brick')
simpleFrame(5,3,-20, 5,8, 'box_green')

# pink window
simpleFrame(5,10,-20, 5,8, 'box_pink')  
flat_xy(5,10,-20, 5,8, 'glass_blue')

# yellow window
flat_xy(5, 18, -20, 5,8, 'glass_blue')
simpleFrame(5,18,-20, 5,8, 'box_yellow')

18-05, red window with 'air' panel

# add `air` to `materials` if it's not in previous code
materials['air'] = 0

# a red window with 'air' panel
flat_xy(15, 3, -20, 5,8, 'air')
simpleFrame(15,3,-20, 5,8, 'box_red')

18-06, Function window()

Function windowFrame()

# window should have even number h, w
def windowFrame(x,y,z,h,w,m):
  bar_x(x,y,z,w,m)
  bar_x(x, y+h,z,w,m)
  bar_y(x,y,z,h, m)
  bar_y(x+w, y,z, h+1, m)

  bar_x(x, y+h/2, z,w,m)
  bar_y(x+w/2, y,z,h,m)

# try a purple window with this new frame    
flat_xy(18,12,-20,10,8, 'air')
windowFrame(18,12,-20,10,8, 'linen_purple')

Function window()

def window(x,y,z,h,w,m):
  materials['air'] = 0
  flat_xy(x, y, z, h, w, 'air')    # 'air' panel
  windowFrame(x,y,z,h,w,m)

# many windows
window(30,8,-20,6,6,'quartz')
window(40, 10, -20, 10, 6, 'linen_orange')
window(30,20,-20,4,8,'linen_light_blue')

House

18-07, House body, doors and windows

# house body
cube(1,1,-20, 30, 'linen_light_blue')       

# front door and windows
door(13,9, 'box_red')               # red door
window(3,5,9,16,8, 'linen_blue')      # blue window
window(20,5,9,16,8, 'linen_blue')

# back door and window
door(20,-20, 'box_red')
window(3,5,-20, 20,14, 'linen_blue')

# red roof
flat_xz(-1,31,-22,34,34, 'linen_red') 

# door steps
flat_xz(12,1,9,2,8, 'cobblestone')
flat_xz(10,0,10, 5, 12, 'cobblestone')

results matching ""

    No results matching ""