Blocks_pile class

similar to Marble_bag

Simple class: Wand

Wand object can make it's handle(gray color) at location (x,y,z), and it can get longer in x, y directions with special color.

game.clear_screen()

# class Wand
class Wand:
  def __init__(self, x, y, z):
    self.x = x
    self.y = y
    self.z = z

  def handle(self):
    block(self.x, self.y, self.z, 'box_gray')

  def xLonger(self, n, color):
    for i in range(1, n+1):
      block(self.x+i, self.y, self.z, color)

  def yLonger(self, n, color):
    for j in range(1, n+1):
      block(self.x, self.y+j, self.z, color)

# some Wand objects
s = Wand(0,3, -20)
s.handle()
s.xLonger(3, 'box_pink')

t = Wand(-2, 5, -18)
t.handle()
t.yLonger(6, 'box_blue')

results matching ""

    No results matching ""