Advertisement
giganciprogramowania

Lesson 11. The Siege

Dec 13th, 2021
544
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #castle creating function
  2. #the minimum length of the walls is 20. if the walls are shorter the stairs won't be generated correctly
  3. #the length of the walls has to be EVEN or the corners won't be generated correctly
  4. #the recommended wall height is 4. Only then the creepers can get activated and explode
  5. def castleBuilder(wallLength, wallHeight):
  6.     wallLengthCopy = wallLength / 2
  7.     builder.teleport_to(pos(-5, 0, 5))
  8.     builder.set_origin()
  9.     builder.mark()
  10.     i = 0
  11.     #the loop creating 3 layer wall around the player
  12.     while i < 3:
  13.         j = 0
  14.         while j < 4:
  15.             builder.move(FORWARD, wallLength)
  16.             builder.raise_wall(MOSSY_STONE_BRICKS, wallHeight)
  17.             builder.turn(RIGHT_TURN)
  18.             j += 1
  19.         wallLength += -2
  20.         builder.move(RIGHT, 1)
  21.         builder.move(FORWARD, 1)
  22.         builder.mark()
  23.         i += 1
  24.     builder.move(UP, wallHeight - 1)
  25.     builder.face(WEST)
  26.     builder.move(BACK, 15)
  27.     builder.mark()
  28.     i = 0
  29.     #the loop creating stairs
  30.     while i < wallHeight - 1:
  31.         builder.shift(1, -1, 0)
  32.         builder.line(STONE_BRICK_STAIRS)
  33.         i += 1
  34.     builder.teleport_to_origin()
  35.     builder.move(UP, wallHeight)
  36.     builder.face(NORTH)
  37.     builder.mark()
  38.     i = 0
  39.     #the loop creating corners
  40.     while i < 4:
  41.         j = 0
  42.         while j < wallLengthCopy:
  43.             builder.place(SEA_LANTERN)
  44.             builder.move(FORWARD, 2)
  45.             j += 1
  46.         builder.turn(RIGHT_TURN)
  47.         i += 1
  48. player.on_chat("castle", castleBuilder)
  49.  
  50.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement