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)
示例#2
0
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)
示例#3
0
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
示例#5
0
def inputNext():
    return input.wasPressedSinceLast(ord('N'))
示例#6
0
def inputLevelUp():
    return input.wasPressedSinceLast(ord('L'))
示例#7
0
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
示例#8
0
def inputRotateRight():
    return input.wasPressedSinceLast(input.NEXT) or input.wasPressedSinceLast(
        input.UP)
示例#9
0
def inputMoveRight():
    return input.wasPressedSinceLast(input.RIGHT)
def inputMoveLeft():
    return input.wasPressedSinceLast(input.LEFT)
def inputPause():
    return input.wasPressedSinceLast(ord('P'))
示例#12
0
def inputMoveDown():
    return input.wasPressedSinceLast(input.DOWN)
def inputLevelUp():
    return input.wasPressedSinceLast(ord('L'))
def inputNext():
    return input.wasPressedSinceLast(ord('N'))
def inputRotateRight():
    return input.wasPressedSinceLast(input.NEXT)
def inputRotateLeft():
    return input.wasPressedSinceLast(input.PRIOR)
def inputMoveRight():
    return input.wasPressedSinceLast(input.RIGHT)
示例#18
0
def inputMoveLeft():
    return input.wasPressedSinceLast(input.LEFT)
示例#19
0
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
示例#20
0
def inputRotateLeft():
    return input.wasPressedSinceLast(input.PRIOR)
def inputMoveDown():
    return input.wasPressedSinceLast(input.DOWN)