After defeating the skeleton guards we will code a moving elevator in Minecraft using a for loop program.
#Elevator import mcpi.minecraft as minecraft import mcpi.block as block import time mc = minecraft.Minecraft.create() mc.postToChat("Elevator: Active") time.sleep(2) playerPos = mc.player.getPos() for counter in range(1,52): mc.setBlocks(playerPos.x-2,playerPos.y-counter,playerPos.z, playerPos.x-7,playerPos.y-counter,playerPos.z-5,block.GOLD_BLOCK) time.sleep(.5) if counter <= 50: mc.setBlocks(playerPos.x-2,playerPos.y-counter,playerPos.z, playerPos.x-7,playerPos.y-counter,playerPos.z-5,0) counter = counter + 2