SHOW:
|
|
- or go back to the newest paste.
| 1 | - | #funkcja tworząca zamek |
| 1 | + | #castle creating function |
| 2 | - | #minimalna długość murów to 20 przy mniejszych wartościach schody nie generują się poprawnie |
| 2 | + | #the minimum length of the walls is 20. if the walls are shorter the stairs won't be generated correctly |
| 3 | - | #liczba określająca długość murów musi być PARZYSTA żeby wierzchołki się poprawnie wygenerowały |
| 3 | + | #the length of the walls has to be EVEN or the corners won't be generated correctly |
| 4 | - | #zalecana wysokość muru to 4, tylko wtedy creppery będą mogły się aktywować i wybuchnąć |
| 4 | + | #the recommended wall height is 4. Only then the creepers can get activated and explode |
| 5 | def castleBuilder(wallLength, wallHeight): | |
| 6 | - | def zamekKonstruktor(mur,wysokosc): |
| 6 | + | wallLengthCopy = wallLength / 2 |
| 7 | - | dlMuru = mur |
| 7 | + | |
| 8 | - | dlMuruKopia = dlMuru / 2 |
| 8 | + | |
| 9 | - | wysokoscMuru = wysokosc |
| 9 | + | |
| 10 | i = 0 | |
| 11 | #the loop creating 3 layer wall around the player | |
| 12 | while i < 3: | |
| 13 | j = 0 | |
| 14 | - | #pętla tworząca 3 warstwowe mury dookoła gracza |
| 14 | + | |
| 15 | builder.move(FORWARD, wallLength) | |
| 16 | builder.raise_wall(MOSSY_STONE_BRICKS, wallHeight) | |
| 17 | builder.turn(RIGHT_TURN) | |
| 18 | - | builder.move(FORWARD, dlMuru) |
| 18 | + | |
| 19 | - | builder.raise_wall(MOSSY_STONE_BRICKS, wysokoscMuru) |
| 19 | + | wallLength += -2 |
| 20 | builder.move(RIGHT, 1) | |
| 21 | builder.move(FORWARD, 1) | |
| 22 | - | dlMuru += -2 |
| 22 | + | |
| 23 | i += 1 | |
| 24 | builder.move(UP, wallHeight - 1) | |
| 25 | builder.face(WEST) | |
| 26 | builder.move(BACK, 15) | |
| 27 | - | builder.move(UP, wysokoscMuru - 1) |
| 27 | + | |
| 28 | i = 0 | |
| 29 | #the loop creating stairs | |
| 30 | while i < wallHeight - 1: | |
| 31 | builder.shift(1, -1, 0) | |
| 32 | - | #pętla tworząca schody |
| 32 | + | |
| 33 | - | while i < wysokoscMuru - 1: |
| 33 | + | |
| 34 | builder.teleport_to_origin() | |
| 35 | builder.move(UP, wallHeight) | |
| 36 | builder.face(NORTH) | |
| 37 | builder.mark() | |
| 38 | - | builder.move(UP, wysokoscMuru) |
| 38 | + | |
| 39 | #the loop creating corners | |
| 40 | while i < 4: | |
| 41 | j = 0 | |
| 42 | - | #pętla tworząca wierzchołki |
| 42 | + | while j < wallLengthCopy: |
| 43 | builder.place(SEA_LANTERN) | |
| 44 | builder.move(FORWARD, 2) | |
| 45 | - | while j < dlMuruKopia: |
| 45 | + | |
| 46 | builder.turn(RIGHT_TURN) | |
| 47 | i += 1 | |
| 48 | player.on_chat("castle", castleBuilder)
| |
| 49 | ||
| 50 |