예제 #1
0
def back():
    """
    Attemps to move you down one level.
    """
    data = game.readSession()
    data["gameStats"]["level"] -= 1
    if data["gameStats"]["level"] == -1:
        print("You are already at the beginning. You can only move forward.")
    else:
        downOne = data["gameStats"]["level"]
        game.writeSession(data)
        game.level(downOne)
예제 #2
0
def fwd(stateDict):
    """
    Attemps to move you one level up.
    """
    if stateDict["finished"] is True:
        data = game.readSession()
        data["gameStats"]["level"] += 1
        upOne = data["gameStats"]["level"]
        game.writeSession(data)
        game.level(upOne)
    else:
        print("You have not yet completed this chapter in your story.")
예제 #3
0
파일: test.py 프로젝트: aquach/volt
def platform():
    e = EntityFactory.Create('Triangle')
    e.SetScale(Vector2(3, 1))
    e.SetPosition(Vector2(3, -5))
    scene().Add(e)

    speed = 2
    duration = 3

    # Address issue with Triangles being static. Maybe have a setting for
    # bodies that have close-to-infinite mass but are dynamic? How is
    # mass going to work?
    tween = CompositeTweenFloat()
    tween.AddTween(TweenFloat.Linear(speed, -speed, duration))
    tween.AddTween(TweenFloat.Linear(-speed, speed, duration))
    start = time.time()
    while not level().IsUnloading():
        time.sleep(0.01)
        elapsed = time.time() - start
        if elapsed > duration * 2:
            start = time.time()
        tween.SetTime(elapsed)
        e.body().SetLinearVelocity(Vector2(0, tween.value()).ToB2())
        #print tween.value()
    e.RemoveSelf()
예제 #4
0
파일: test.py 프로젝트: aquach/volt
def fadeOut():
    tween = TweenFloat.Linear(0, 1, 2)
    start = time.time()
    while not tween.finished():
        time.sleep(0.01)
        tween.SetTime(time.time() - start)
        blendFilter.setBlendAmount(tween.value())
    level().RequestLevelChange("Levels/lights.json")
    time.sleep(2)
    tween = TweenFloat.Linear(1, 0, 2)
    start = time.time()
    # TODO: The main script executed by runScriptFile is joined when the level
    # unloads. But any threads that it spawns will hang around. This might be a
    # problem.
    while not tween.finished():
        time.sleep(0.01)
        tween.SetTime(time.time() - start)
        blendFilter.setBlendAmount(tween.value())