Пример #1
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)
Пример #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'))
Пример #4
0
    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)
Пример #10
0
def inputMoveLeft():
    return input.wasPressedSinceLast(input.LEFT)
Пример #11
0
def inputPause():
    return input.wasPressedSinceLast(ord('P'))
Пример #12
0
def inputMoveDown():
    return input.wasPressedSinceLast(input.DOWN)
Пример #13
0
def inputLevelUp():
    return input.wasPressedSinceLast(ord('L'))
Пример #14
0
def inputNext():
    return input.wasPressedSinceLast(ord('N'))
Пример #15
0
def inputRotateRight():
    return input.wasPressedSinceLast(input.NEXT)
Пример #16
0
def inputRotateLeft():
    return input.wasPressedSinceLast(input.PRIOR)
Пример #17
0
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)
Пример #21
0
def inputMoveDown():
    return input.wasPressedSinceLast(input.DOWN)