def answerYes(): input.clearPressBuffer(ord('Y')) input.clearPressBuffer(ord('N')) while True: if input.wasPressedSinceLast(ord('Y')): return True if input.wasPressedSinceLast(ord('N')): return False sleep(0.1)
def inputPause(): return input.wasPressedSinceLast(ord('P'))
entity = mc.spawnEntity(argv[1], playerPos.x - sin(radians(playerYaw)), playerPos.z, playerPos.z + cos(radians(playerYaw)), "{NoAI:1}") player = False else: entity = mc.getPlayerId() lastPlatform = None lastPlatformBlock = None UNSOLID = set([WATER_FLOWING.id,WATER_STATIONARY.id,AIR.id,LAVA_FLOWING.id,LAVA_STATIONARY.id]) while True: pos = mc.entity.getPos(entity) yaw = mc.entity.getRotation(entity) move = False if input.wasPressedSinceLast(input.NEXT): pos.y -= 1 move = True if input.wasPressedSinceLast(input.PRIOR): pos.y += 1 move = True if input.wasPressedSinceLast(input.LEFT): yaw -= 15 mc.entity.setRotation(entity,yaw) if input.wasPressedSinceLast(input.RIGHT): yaw += 15 mc.entity.setRotation(entity,yaw) if input.wasPressedSinceLast(input.UP): pos.x += .5 * -sin(radians(yaw)) pos.z += .5 * cos(radians(yaw)) move = True
def inputNext(): return input.wasPressedSinceLast(ord('N'))
def inputLevelUp(): return input.wasPressedSinceLast(ord('L'))
else: entity = mc.getPlayerId() lastPlatform = None lastPlatformBlock = None UNSOLID = set([ block.WATER_FLOWING.id, block.WATER_STATIONARY.id, block.AIR.id, block.LAVA_FLOWING.id, block.LAVA_STATIONARY.id ]) while True: pos = mc.entity.getPos(entity) yaw = mc.entity.getRotation(entity) move = False if input.wasPressedSinceLast(input.NEXT): pos.y -= 1 move = True if input.wasPressedSinceLast(input.PRIOR): pos.y += 1 move = True if input.wasPressedSinceLast(input.LEFT): yaw -= 15 mc.entity.setRotation(entity, yaw) if input.wasPressedSinceLast(input.RIGHT): yaw += 15 mc.entity.setRotation(entity, yaw) if input.wasPressedSinceLast(input.UP): pos.x += .5 * -sin(radians(yaw)) pos.z += .5 * cos(radians(yaw)) move = True
def inputRotateRight(): return input.wasPressedSinceLast(input.NEXT) or input.wasPressedSinceLast( input.UP)
def inputMoveRight(): return input.wasPressedSinceLast(input.RIGHT)
def inputMoveLeft(): return input.wasPressedSinceLast(input.LEFT)
def inputMoveDown(): return input.wasPressedSinceLast(input.DOWN)
def inputRotateRight(): return input.wasPressedSinceLast(input.NEXT)
def inputRotateLeft(): return input.wasPressedSinceLast(input.PRIOR)
while True: if x < 0 or x >= width or y < 0 or y >= height or (x, y) in tail: board.setBlock(x, y, block.WOOL_RED) board.draw() mc.postToChat("Game over") break tail.append((x, y)) if len(tail) > length: board.setBlock(tail[0], block.AIR) del tail[0] if board.getBlock(x, y) == block.GOLD_BLOCK: length += 1 newGold() board.setBlock(x, y, block.BRICK_BLOCK) board.draw() sleep(0.05 + 1.5 / length) if input.wasPressedSinceLast(input.UP): vy = 1 vx = 0 elif input.wasPressedSinceLast(input.DOWN): vy = -1 vx = 0 elif input.wasPressedSinceLast(input.LEFT): vy = 0 vx = -1 elif input.wasPressedSinceLast(input.RIGHT): vy = 0 vx = 1 x += vx y += vy