# After starting the program get the player's coordinates which will be used in the entire project
# We will only update the Z coordinate of the player to be able to correctly add stages
position=player.position()
x=position.get_value(Axis.X)
y=position.get_value(Axis.Y)
z=position.get_value(Axis.Z)
#function creating the first fragment of the course
def course():
#create the shape of the course from bedrock
blocks.fill(BEDROCK, world(x-10,y-1,z-2),world(x+10,y+10,z+35),FillOperation.HOLLOW)
#the line lauching stage 1
blocks.fill(SEA_LANTERN, world(x-9,y-1,z+3),world(x+9,y-1,z+5))
#gameplay.set_game_mode(SURVIVAL, mobs.target(NEAREST_PLAYER))
player.on_chat("start", course)
while True:
if blocks.test_for_block(SEA_LANTERN, pos(0, -1, 0)):
position=player.position()
z=position.get_value(Axis.Z)
stage1(z)
loops.pause(3000)
def stage1(z):
player.say("STAGE 1")
blocks.fill(BEDROCK, world(x-10,y-1,z-5),world(x+10,y-1,z+5))
blocks.fill(BEDROCK, world(x-10,y,z-3),world(x+10,y+10,z-1))
blocks.fill(GOLD_BLOCK, world(x-9,y-1,z+25),world(x+9,y-1,z+27))
blocks.fill(IRON_BARS, world(x-9,y-1,z+3),world(x+9,y-1,z+20))
blocks.fill(LAVA, world(x-9,y-2,z+3),world(x+9,y-2,z+20))
while True:
if blocks.test_for_block(IRON_BARS, pos(0, -1, 0)):
mobs.give(mobs.target(NEAREST_PLAYER), DIAMOND_AXE, 1)
for i in range(6):
mobs.spawn(CREEPER, randpos(world(x-8,y+1,z+3),
world(x+8,y+1,z+20)))
break