コード例 #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)