Exemplo n.º 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)
Exemplo n.º 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)
Exemplo n.º 3
0
def inputPause():
    return input.wasPressedSinceLast(ord('P'))
Exemplo n.º 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
Exemplo n.º 5
0
def inputNext():
    return input.wasPressedSinceLast(ord('N'))
Exemplo n.º 6
0
def inputLevelUp():
    return input.wasPressedSinceLast(ord('L'))
Exemplo n.º 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
Exemplo n.º 8
0
def inputRotateRight():
    return input.wasPressedSinceLast(input.NEXT) or input.wasPressedSinceLast(
        input.UP)
Exemplo n.º 9
0
def inputMoveRight():
    return input.wasPressedSinceLast(input.RIGHT)
Exemplo n.º 10
0
def inputMoveLeft():
    return input.wasPressedSinceLast(input.LEFT)
Exemplo n.º 11
0
def inputPause():
    return input.wasPressedSinceLast(ord('P'))
Exemplo n.º 12
0
def inputMoveDown():
    return input.wasPressedSinceLast(input.DOWN)
Exemplo n.º 13
0
def inputLevelUp():
    return input.wasPressedSinceLast(ord('L'))
Exemplo n.º 14
0
def inputNext():
    return input.wasPressedSinceLast(ord('N'))
Exemplo n.º 15
0
def inputRotateRight():
    return input.wasPressedSinceLast(input.NEXT)
Exemplo n.º 16
0
def inputRotateLeft():
    return input.wasPressedSinceLast(input.PRIOR)
Exemplo n.º 17
0
def inputMoveRight():
    return input.wasPressedSinceLast(input.RIGHT)
Exemplo n.º 18
0
def inputMoveLeft():
    return input.wasPressedSinceLast(input.LEFT)
Exemplo n.º 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
Exemplo n.º 20
0
def inputRotateLeft():
    return input.wasPressedSinceLast(input.PRIOR)
Exemplo n.º 21
0
def inputMoveDown():
    return input.wasPressedSinceLast(input.DOWN)