Advertisement
mralasic

parkour - gotov prvi dio

May 7th, 2022
1,046
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.33 KB | None | 0 0
  1. #the current spot of respawning the player which will change depending on the checkpoint
  2. currentRespawnPosition=player.position()
  3. #this varialbe will make sure that the stage is only created once during the gameplay
  4. isStage1=False
  5. isStage2=False
  6.  
  7. def death():
  8.     player.teleport(currentRespawnPosition)
  9. player.on_died(death)
  10.  
  11. #building the stairs and the platform loading stage 1
  12. def newParkour():
  13.     #teleporting the builder close to the player
  14.     builder.teleport_to(pos(5, 0, 0))
  15.     #rotate it
  16.     builder.face(EAST)
  17.     for i in range(70):
  18.         #the builder places a stairs block
  19.         builder.place(PURPUR_STAIRS)
  20.         #the builder moves up and forward
  21.         builder.shift(1, 1, 0)
  22.     #marking the current position of the builder
  23.     builder.mark()
  24.     #moving the builder
  25.     builder.shift(2, 0, -4)
  26.     #the builder fills the space between its position and the mark with blocks
  27.     builder.fill(DIAMOND_BLOCK)
  28.  
  29. player.on_chat("start", newParkour)
  30.  
  31. def stage1and2(builderRotation,courseType,checkpointType):
  32.     #teleporting the builder under the platform and shifting it
  33.     builder.teleport_to(pos(1, -4, 0))
  34.     builder.mark()
  35.     builder.face(EAST)
  36.     for i in range(2):
  37.         for j in range(5):
  38.             #moving the builder
  39.             builder.move(FORWARD, randint(3, 8))
  40.             #creating a line of the certain block
  41.             builder.line(courseType)
  42.             #moving the builder to create a space between blocks
  43.             builder.move(FORWARD, randint(2, 4))
  44.             #marking the position so the next line is built starting from it
  45.             builder.mark()
  46.             #turning the builder
  47.         builder.turn(builderRotation)
  48.     #creating a new platform
  49.     builder.mark()
  50.     builder.shift(2, 0, -4)
  51.     builder.fill(checkpointType)
  52.  
  53. #the loop controlling loading stages and checkpoint system
  54. while True:
  55.     if blocks.test_for_block(DIAMOND_BLOCK, pos(0, -1, 0)) and not isStage1:
  56.         #updating player's position
  57.         currentRespawnPosition = player.position()
  58.         isStage1 = True
  59.         stage1and2(RIGHT_TURN,SLIME_BLOCK,GOLD_BLOCK)
  60.     elif blocks.test_for_block(GOLD_BLOCK, pos(0, -1, 0)) and not isStage2:
  61.         currentRespawnPosition = player.position()
  62.         isStage2 = True
  63.         stage1and2(LEFT_TURN,MAGENTA_STAINED_GLASS_PANE,BEDROCK)
  64.  
  65.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement