Ich habe an zwei Projekten gearbeitet:
Die Fassade von Gambach wurde hauptsächlich mit While-Schleifen gebaut. Es platziert mit block.place() jedes einzelne Block. Für das VAB hingegen habe ich die viel effizientere Blocks.fill() Funktion benutzt die es ermöglicht schneller, effizienter und grösser zu bauen.
Die Idee mit dem VAB fand ich gut, da es ein grosses Gebäude ist und dementsprechend so Details eingabaut werden können. Hinzu kommt, dass das Gebäude mit geometrischen Formen nachbaubar ist und so für Minecraft und Python gut geeignet ist. Der grosse Weisse Teil vom Hauptgebäude entspricht den Proportionen vom echten Gebäude. Der Rest ist nicht Massstabsgetreu, ich habe dazu keine Angaben gefunden und so nur mit Augenmass gearbeitet.
#Gambach
def on_on_chat():
Build_Gambach()
player.on_chat("Gambach", on_on_chat)
def Build_Gambach():
a=0
b=0
#Fassade
blocks.fill(BLOCK_OF_QUARTZ, pos(5, 0, 0), pos(5, 16, 19))
#Eingangsausschnitt
b=4
while b<20:
a=0
while a<3:
blocks.place(AIR, pos(5, a, b))
a=a+1
b=b+1
#Eingang
c=1
while c<5:
b=1
while b<(4+(c*4)):
a=0
while a<3:
blocks.place(BLACK_CONCRETE, pos(5+c, a, b))
a=a+1
b=b+1
c=c+1
#Eingang esthetik
c=0
while c<5:
b=0
while b<20:
blocks.place(BLOCK_OF_QUARTZ, pos(5+c, 3, b))
b=b+1
c=c+1
#fenster
c=0
while c<3:
b=4
while b<10:
a=0
while a<2:
blocks.place(AIR, pos(5, 4+(c*3)+a, b))
a=a+1
b=b+1
c=c+1
#fenster2
c=0
while c<3:
b=11
while b<18:
a=0
while a<2:
blocks.place(AIR, pos(5, 5+(c*3)+a, b))
a=a+1
b=b+1
c=c+1
#fensterhintergrund
c=0
while c<3:
b=4
while b<10:
a=0
while a<2:
blocks.place(LIGHT_GRAY_TERRACOTTA, pos(6, 4+(c*3)+a, b))
a=a+1
b=b+1
c=c+1
#fenster2hintergrund
c=0
while c<3:
b=11
while b<18:
a=0
while a<2:
blocks.place(LIGHT_GRAY_TERRACOTTA, pos(6, 5+(c*3)+a, b))
a=a+1
b=b+1
c=c+1
#fensterscheiben
c=0
while c<3:
b=4
while b<10:
a=0
while a<2:
blocks.place(GLASS, pos(5, 4+(c*3)+a, b))
a=a+1
b=b+1
c=c+1
#fenster2scheiben
c=0
while c<3:
b=11
while b<18:
a=0
while a<2:
blocks.place(GLASS, pos(5, 5+(c*3)+a, b))
a=a+1
b=b+1
c=c+1
#Dach1
c=0
while c<4:
b=0
while b<(2+(c*2)):
a=0
while a<3:
blocks.place(AIR, pos(5, 14+c, b))
a=a+1
b=b+1
c=c+1
#Dach2
c=0
while c<3:
shapes.line(AIR, pos(5, 16-c, 8+(c*4)), pos(5, 16-c, 20))
c=c+1
def on_on_chat(): build_it() player.on_chat("build", on_on_chat) def build_it(): #Weisser Körper und schwarze Hangartüren blocks.fill(BLOCK_OF_QUARTZ, pos(15, 0, 0), pos(15, 80, 80)) #Vorderwand blocks.fill(BLOCK_OF_QUARTZ, pos(125, 0, 0), pos(125, 80, 80)) #Hinterwand blocks.fill(BLOCK_OF_QUARTZ, pos(15, 0, 0), pos(125, 80, 0)) #Seitenwand links blocks.fill(BLOCK_OF_QUARTZ, pos(15, 0, 80), pos(125, 80, 80)) #Seitenwand rechts blocks.fill(BLOCK_OF_QUARTZ, pos(15, 80, 0), pos(125, 80, 80)) #Deckel a=0 #Tor links while a<8: blocks.fill(BLACK_WOOL, pos(15, 0+(a*10), 10), pos(15-a, 10+(a*10), 30)) a=a+1 a=0 #Tor rechts while a<8: blocks.fill(BLACK_WOOL, pos(15, 0+(a*10), 50), pos(15-a, 10+(a*10), 70)) a=a+1 #Grauer rahmen blocks.fill(LIGHT_GRAY_CONCRETE, pos(50, 80, 0), pos(90, 70, 0)) blocks.fill(LIGHT_GRAY_CONCRETE, pos(50, 80, 0), pos(54, 0, 0)) blocks.fill(LIGHT_GRAY_CONCRETE, pos(90, 80, 0), pos(86, 0, 0)) #Amerikanische Flagge blocks.fill(BLUE_CONCRETE, pos(120, 76, 0), pos(107, 61, 0)) #Blaues viereck blocks.fill(RED_CONCRETE, pos(120, 60, 0), pos(119, 37, 0)) #Streifen 1 blocks.fill(RED_CONCRETE, pos(116, 60, 0), pos(115, 37, 0)) #Streifen 2 blocks.fill(RED_CONCRETE, pos(112, 60, 0), pos(111, 37, 0)) #Streifen 3 blocks.fill(RED_CONCRETE, pos(108, 60, 0), pos(107, 37, 0)) #Streifen 4 #Lange Streifen blocks.fill(RED_CONCRETE, pos(104, 76, 0), pos(103, 37, 0)) #Streifen 5 blocks.fill(RED_CONCRETE, pos(100, 76, 0), pos(99, 37, 0)) #Streifen 6 blocks.fill(RED_CONCRETE, pos(96, 76, 0), pos(95, 37, 0)) #Streifen 7 #BIG BLUE SQUARE blocks.fill(LIGHT_BLUE_TERRACOTTA, pos(80, 0, 0), pos(60, 60, 0)) #Nasa Logo circle shapes.circle(BLUE_CONCRETE, pos(32, 55, 0), 12, Axis.Z, ShapeOperation.REPLACE) #RED LINE shapes.line(RED_CONCRETE, pos(44, 50, 0), pos(21, 63, 0)) shapes.line(RED_CONCRETE, pos(44, 43, 0), pos(21, 63, 0)) #NASA Schrift #BUCHSTABE A (nasA) blocks.fill(BLOCK_OF_QUARTZ, pos(23, 53, 0), pos(23, 56, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(26, 53, 0), pos(26, 56, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(24, 57, 0), pos(25, 57, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(24, 54, 0), pos(25, 54, 0)) #BUCHSTABE A (nAsa) blocks.fill(BLOCK_OF_QUARTZ, pos(33, 53, 0), pos(33, 56, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(36, 53, 0), pos(36, 56, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(34, 57, 0), pos(35, 57, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(34, 54, 0), pos(35, 54, 0)) #BUCHSTABE A (Nasa) blocks.fill(BLOCK_OF_QUARTZ, pos(38, 53, 0), pos(38, 57, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(41, 53, 0), pos(41, 57, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(40, 55, 0), pos(40, 56, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(39, 54, 0), pos(39, 55, 0)) #BUCHSTABE S (naSa) blocks.fill(BLOCK_OF_QUARTZ, pos(29, 53, 0), pos(31, 53, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(28, 57, 0), pos(30, 57, 0)) blocks.fill(BLOCK_OF_QUARTZ, pos(29, 55, 0), pos(30, 55, 0)) blocks.place(BLOCK_OF_QUARTZ, pos(31, 56, 0)) blocks.place(BLOCK_OF_QUARTZ, pos(28, 54, 0)) #BIG WHITE CUBE blocks.fill(BLOCK_OF_QUARTZ, pos(85, 0, -30), pos(55, 30, 0)) #SMALL BLUE SQUARE blocks.fill(LIGHT_BLUE_TERRACOTTA, pos(80, 0, -30), pos(60, 25, -30))
Mein Projekt ist ein Riesenrad. Ich habe den Code so geschrieben, dass durch das eintippen von „run“ im Chat, ein Riesenrad gebaut wird.
Ich habe vor allem die Funktionen shapes.circle() und blocks.fill() benutzt.
Die Dächer der Kutschen haben eine zufällig generierte Farbe welche ich in einer Liste definiert habe.
Da ich den code mit der Position des Spielers als Ausgangspunkt bestimmt habe, darf sich der Spieler während der Konstruktionsphase nicht bewegen. Dies stelle ich mit einem Glaskäfig sicher. Dieser Glaskäfig wird nach der Konstruktion wieder abgebaut, sodass der Spieler sich wieder Bewegen kann.
#Variables posX1=20 posX2=posX1+6 i=5 heightFW=22 FWFillRadius=20 FWCarveRadius=FWFillRadius-2 #GondelaRoof List GondelaRoofList = (RED_WOOL, BLUE_WOOL, GREEN_WOOL, YELLOW_WOOL, LIGHT_BLUE_WOOL, CYAN_WOOL) GondelaRoofBlock = GondelaRoofList[randint(0, i)] def on_chat(): glasscage() player.say("Construction sequence initiated. Don't move.") circle() supportlegs() supportbeams() gondela() destroyglasscage() player.say("Construction complete. You can move now.") player.on_chat("run", on_chat) def circle(): #Front Wheel shapes.circle(IRON_BLOCK, pos(posX1, heightFW, 0), FWFillRadius, Axis.X, ShapeOperation.REPLACE) shapes.circle(AIR, pos(posX1, heightFW, 0), FWCarveRadius, Axis.X, ShapeOperation.REPLACE) shapes.circle(IRON_BLOCK, pos(posX1-1, heightFW, 0), FWFillRadius-1, Axis.X, ShapeOperation.REPLACE) shapes.circle(AIR, pos(posX1-1, heightFW, 0), FWCarveRadius-1, Axis.X, ShapeOperation.REPLACE) #Back Wheel shapes.circle(IRON_BLOCK, pos(posX2, heightFW, 0), FWFillRadius, Axis.X, ShapeOperation.REPLACE) shapes.circle(AIR, pos(posX2, heightFW, 0), FWCarveRadius, Axis.X, ShapeOperation.REPLACE) shapes.circle(IRON_BLOCK, pos(posX2+1, heightFW, 0), FWFillRadius-1, Axis.X, ShapeOperation.REPLACE) shapes.circle(AIR, pos(posX2+1, heightFW, 0), FWCarveRadius-1, Axis.X, ShapeOperation.REPLACE) def supportbeams(): #Middle Beam blocks.fill(IRON_BLOCK, pos(posX1-4, heightFW, 0), pos(posX2+4, heightFW, 0)) #Horizontal Beams blocks.fill(STONE, pos(posX1, heightFW, -18), pos(posX1, heightFW, 18)) #1 blocks.fill(STONE, pos(posX2, heightFW, -18), pos(posX2, heightFW, 18)) #2 #Vertical Beams blocks.fill(STONE, pos(posX1, 40, 0), pos(posX1, 4, 0)) #1 blocks.fill(STONE, pos(posX2, 40, 0), pos(posX2, 4, 0)) #2 #Diagonal Beam Right to Left shapes.line(STONE, pos(posX1, 10, -12), pos(posX1, 34, 12)) #1 shapes.line(STONE, pos(posX2, 10, -12), pos(posX2, 34, 12)) #2 #Diagonal Beam Left to Right shapes.line(STONE, pos(posX1, 34, -12), pos(posX1, 10, 12)) #1 shapes.line(STONE, pos(posX2, 34, -12), pos(posX2, 10, 12)) #2 def supportlegs(): #Front Support Leg shapes.line(STONE, pos(posX1-4, 0, -12), pos(posX1-2, 23, 0)) #Left shapes.line(STONE, pos(posX1-4, 0, -12), pos(posX1-2, 22, 0)) #Left shapes.line(STONE, pos(posX1-4, 0, 12), pos(posX1-2, 23, 0)) #Right shapes.line(STONE, pos(posX1-4, 0, 12), pos(posX1-2, 22, 0)) #Right #Back Support Leg shapes.line(STONE, pos(posX2+4, 0, -12), pos(posX2+2, 23, 0)) #Left shapes.line(STONE, pos(posX2+4, 0, -12), pos(posX2+2, 22, 0)) #Left shapes.line(STONE, pos(posX2+4, 0, 12), pos(posX2+2, 23, 0)) #Right shapes.line(STONE, pos(posX2+4, 0, 12), pos(posX2+2, 22, 0)) #Right def gondela(): #Gondela 30' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, -1, -2), pos(posX1+5, -1, 2)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 3, -2), pos(posX1+5, 3, 2)) blocks.fill(AIR, pos(posX1+1, -1, -2), pos(posX1+1, 3, -2)) blocks.fill(AIR, pos(posX1+1, -1, 2), pos(posX1+1, 3, 2)) blocks.fill(AIR, pos(posX1+5, -1, -2), pos(posX1+5, 3, -2)) blocks.fill(AIR, pos(posX1+5, -1, 2), pos(posX1+5, 3, 2)) blocks.fill(GLASS, pos(posX1+2, 0, -1), pos(posX1+4, 2, 1)) #Gondela 0' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, 37, -2), pos(posX1+5, 37, 2)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 41, -2), pos(posX1+5, 41, 2)) blocks.fill(AIR, pos(posX1+1, 37, -2), pos(posX1+1, 41, -2)) blocks.fill(AIR, pos(posX1+1, 37, 2), pos(posX1+1, 41, 2)) blocks.fill(AIR, pos(posX1+5, 37, -2), pos(posX1+5, 41, -2)) blocks.fill(AIR, pos(posX1+5, 37, 2), pos(posX1+5, 41, 2)) blocks.fill(GLASS, pos(posX1+2, 38, -1), pos(posX1+4, 40, 1)) #Gondela 45' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, 18, -21), pos(posX1+5, 18, -17)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 22, -21), pos(posX1+5, 22, -17)) blocks.fill(AIR, pos(posX1+1, 18, -21), pos(posX1+1, 22, -21)) blocks.fill(AIR, pos(posX1+1, 18, -17), pos(posX1+1, 22, -17)) blocks.fill(AIR, pos(posX1+5, 18, -21), pos(posX1+5, 22, -21)) blocks.fill(AIR, pos(posX1+5, 18, -17), pos(posX1+5, 22, -17)) blocks.fill(GLASS, pos(posX1+2, 19, -20), pos(posX1+4, 21, -18)) #Gondela 15' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, 18, 21), pos(posX1+5, 18, 17)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 22, 21), pos(posX1+5, 22, 17)) blocks.fill(AIR, pos(posX1+1, 18, 21), pos(posX1+1, 22, 21)) blocks.fill(AIR, pos(posX1+1, 18, 17), pos(posX1+1, 22, 17)) blocks.fill(AIR, pos(posX1+5, 18, 21), pos(posX1+5, 22, 21)) blocks.fill(AIR, pos(posX1+5, 18, 17), pos(posX1+5, 22, 17)) blocks.fill(GLASS, pos(posX1+2, 19, 20), pos(posX1+4, 21, 18)) #Gondela 7'30'' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, 31, 15), pos(posX1+5, 31, 11)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 35, 15), pos(posX1+5, 35, 11)) blocks.fill(AIR, pos(posX1+1, 31, 15), pos(posX1+1, 35, 15)) blocks.fill(AIR, pos(posX1+1, 31, 11), pos(posX1+1, 35, 11)) blocks.fill(AIR, pos(posX1+5, 31, 15), pos(posX1+5, 35, 15)) blocks.fill(AIR, pos(posX1+5, 31, 11), pos(posX1+5, 35, 11)) blocks.fill(GLASS, pos(posX1+2, 32, 14), pos(posX1+4, 34, 12)) #Gondela 52'30'' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, 31, -15), pos(posX1+5, 31, -11)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 35, -15), pos(posX1+5, 35, -11)) blocks.fill(AIR, pos(posX1+1, 31, -15), pos(posX1+1, 35, -15)) blocks.fill(AIR, pos(posX1+1, 31, -11), pos(posX1+1, 35, -11)) blocks.fill(AIR, pos(posX1+5, 31, -15), pos(posX1+5, 35, -15)) blocks.fill(AIR, pos(posX1+5, 31, -11), pos(posX1+5, 35, -11)) blocks.fill(GLASS, pos(posX1+2, 32, -14), pos(posX1+4, 34, -12)) #Gondela 22'30'' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, 4, 15), pos(posX1+5, 4, 11)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 8, 15), pos(posX1+5, 8, 11)) blocks.fill(AIR, pos(posX1+1, 4, 15), pos(posX1+1, 8, 15)) blocks.fill(AIR, pos(posX1+1, 4, 11), pos(posX1+1, 8, 11)) blocks.fill(AIR, pos(posX1+5, 4, 15), pos(posX1+5, 8, 15)) blocks.fill(AIR, pos(posX1+5, 4, 11), pos(posX1+5, 8, 11)) blocks.fill(GLASS, pos(posX1+2, 5, 14), pos(posX1+4, 7, 12)) #Gondela 37'30'' blocks.fill(BLOCK_OF_QUARTZ, pos(posX1+1, 4, -15), pos(posX1+5, 4, -11)) blocks.fill(GondelaRoofList[randint(0, i)], pos(posX1+1, 8, -15), pos(posX1+5, 8, -11)) blocks.fill(AIR, pos(posX1+1, 4, -15), pos(posX1+1, 8, -15)) blocks.fill(AIR, pos(posX1+1, 4, -11), pos(posX1+1, 8, -11)) blocks.fill(AIR, pos(posX1+5, 4, -15), pos(posX1+5, 8, -15)) blocks.fill(AIR, pos(posX1+5, 4, -11), pos(posX1+5, 8, -11)) blocks.fill(GLASS, pos(posX1+2, 5, -14), pos(posX1+4, 7, -12)) def glasscage(): blocks.fill(GLASS, pos(1, 0, -1), pos(-1, 2, 1)) blocks.fill(AIR, pos(0, 0, 0), pos(0, 1, 0)) def destroyglasscage(): blocks.fill(AIR, pos(1, 0, -1), pos(-1, 2, 1))
Für die aztekische Pyramide habe ich am Anfang eine while loop für die Grundpyramide gemacht. Danach habe ich das shapes.line für Treppen benutzt. Zum Schluss habe ich noch das obere Teil hingetan und in der Mitte der Pyramide einen teil mit Luft gefüllt, da die Azteken viele Fallen in ihre Pyramiden einbauten.
x=5 y=0 z=5 m=60 n=1 p=0 #pyramid base while m>32: blocks.fill(MOSSY_STONE_BRICKS, pos(x+p, y, z+p), pos(x+m, y+n, z+m)) m=m-2 n=n+2 p=p+2 #stairs front shapes.line(CHISELED_STONE_BRICKS, pos(x+30, y, z-1), pos(x+30, y+27, z+26)) shapes.line(CHISELED_STONE_BRICKS, pos(x+30, y, z-2), pos(x+30, y+27, z+25)) shapes.line(CHISELED_STONE_BRICKS, pos(x+29, y, z-1), pos(x+29, y+27, z+26)) shapes.line(CHISELED_STONE_BRICKS, pos(x+29, y, z-2), pos(x+29, y+27, z+25)) shapes.line(CHISELED_STONE_BRICKS, pos(x+31, y, z-1), pos(x+31, y+27, z+26)) shapes.line(CHISELED_STONE_BRICKS, pos(x+31, y, z-2), pos(x+31, y+27, z+25)) #stairs right shapes.line(CHISELED_STONE_BRICKS, pos(x-1, y, z+30), pos(x+26, y+27, z+30)) shapes.line(CHISELED_STONE_BRICKS, pos(x-2, y, z+30), pos(x+25, y+27, z+30)) shapes.line(CHISELED_STONE_BRICKS, pos(x-1, y, z+29), pos(x+26, y+27, z+29)) shapes.line(CHISELED_STONE_BRICKS, pos(x-2, y, z+29), pos(x+25, y+27, z+29)) shapes.line(CHISELED_STONE_BRICKS, pos(x-1, y, z+31), pos(x+26, y+27, z+31)) shapes.line(CHISELED_STONE_BRICKS, pos(x-2, y, z+31), pos(x+25, y+27, z+31)) #stairs left shapes.line(CHISELED_STONE_BRICKS, pos(x+61, y, z+30), pos(x+34, y+27, z+30)) shapes.line(CHISELED_STONE_BRICKS, pos(x+62, y, z+30), pos(x+35, y+27, z+30)) shapes.line(CHISELED_STONE_BRICKS, pos(x+61, y, z+29), pos(x+34, y+27, z+29)) shapes.line(CHISELED_STONE_BRICKS, pos(x+62, y, z+29), pos(x+35, y+27, z+29)) shapes.line(CHISELED_STONE_BRICKS, pos(x+61, y, z+31), pos(x+34, y+27, z+31)) shapes.line(CHISELED_STONE_BRICKS, pos(x+62, y, z+31), pos(x+35, y+27, z+31)) #stairs back shapes.line(CHISELED_STONE_BRICKS, pos(x+30, y, z+61), pos(x+30, y+27, z+34)) shapes.line(CHISELED_STONE_BRICKS, pos(x+30, y, z+62), pos(x+30, y+27, z+35)) shapes.line(CHISELED_STONE_BRICKS, pos(x+29, y, z+61), pos(x+29, y+27, z+34)) shapes.line(CHISELED_STONE_BRICKS, pos(x+29, y, z+62), pos(x+29, y+27, z+35)) shapes.line(CHISELED_STONE_BRICKS, pos(x+31, y, z+61), pos(x+31, y+27, z+34)) shapes.line(CHISELED_STONE_BRICKS, pos(x+31, y, z+62), pos(x+31, y+27, z+35)) #top of the pyramid blocks.fill(CHISELED_STONE_BRICKS, pos(x+27, y+28, z+27), pos(x+33, y+34, z+33)) blocks.fill(BLACK_CONCRETE, pos(x+28, y+28, z+28), pos(x+32, y+33, z+32)) blocks.fill(AIR, pos(x+27, y+28, z+29), pos(x+27, y+32, z+31)) blocks.fill(AIR, pos(x+29, y+28, z+27), pos(x+31, y+32, z+27)) blocks.fill(AIR, pos(x+33, y+28, z+29), pos(x+33, y+32, z+31)) blocks.fill(AIR, pos(x+29, y+28, z+33), pos(x+31, y+32, z+33)) #inside of pyramid blocks.fill(AIR, pos(x+27, y, z+27), pos(x+33, y+27, z+33))