Java 类com.badlogic.gdx.scenes.scene2d.actions.MoveByAction 实例源码

项目:DIamondFire    文件:Knight.java   
public void move(int x, int y) {
    float size = 32.0f;
    // Distance in pixels
    float dx = size * x;
    float dy = size * y;

    int destX = getPosX() + x;
    int destY = getPosY() + y;

    MoveByAction moveX = new MoveByAction();
    moveX.setAmountX(dx);
    moveX.setDuration(Math.abs(x) * 0.1f);

    MoveByAction moveY = new MoveByAction();
    moveY.setAmountY(dy);
    moveY.setDuration(Math.abs(y) * 0.1f);

    moveSeq = new SequenceAction(moveX, moveY);
    Speech.getInstance().speak("move " + this.name + " to " + getLetter(destY) + " " + (destX + 1));

    this.setPosition(destY, destX);
    this.addAction(moveSeq);

    moved = true;
    GameState.getInstance().addMove();
}
项目:MathAttack    文件:AbstractActorLight.java   
/**
 * Action move by.
 *
 * @param x the x
 * @param y the y
 * @param duration the duration
 */
public void actionMoveBy(float x, float y, float duration) {
    // Move towards a direction during given time (NON-STOP)
    MoveByAction action = new MoveByAction();
    action.setAmount(x, y);
    if (duration > 0) {
        action.setDuration(duration);
    }
    addAction(action);
}
项目:HAW-SE2-projecthorse    文件:WorldMapUtils.java   
/**
 * Prüft, ob der übergebene Player sich bewegt anhand des Vorhandenseins
 * einer MoveByAction.
 * 
 * @param player
 *            Der Spieler
 * @return true wenn der Player sich bewegt, sonst false
 */
protected static boolean isPlayerMoving(final Player player) {
    Array<Action> actions = player.getActions();

    for (Action action : actions) {
        if (action instanceof MoveByAction) {
            return true;
        }
    }

    return false;
}
项目:HAW-SE2-projecthorse    文件:WorldMap.java   
/**
 * Bewegt den Player von seiner aktuellen Position in einer flüssigen
 * Animation auf geradem Weg zur einer anderen Stadt.
 * 
 * @param city
 *            Die Ziel Stadt.
 */
private void movePlayer(final String city) {
    int[] cityCoordinates = cityInfos.get(city);

    Vector2 source = new Vector2(player.getX() + player.getWidth() / 2
            * player.getScaleX(), player.getY());
    Vector2 target = new Vector2(cityCoordinates[0], cityCoordinates[1]);

    Direction animationDirection = WorldMapUtils.getDirection(source,
            target);
    AnimationAction animationRun = new AnimationAction(animationDirection,
            PLAYERSPEED);

    // Weggelassen, da alleine schon die Existens einer Idle AnimationAction
    // während der Abarbeitung einer anderen AnimationAction
    // stand 14.12.14 zum Fehler führt
    // AnimationAction animationIdle = new
    // AnimationAction(WorldMapUtils.getIdleDirection(animationDirection));
    // SequenceAction animationSequence = new SequenceAction(animationRun,
    // animationIdle);

    MoveByAction movement = new MoveByAction();
    movement.setAmount(target.x - source.x, target.y - source.y);
    movement.setDuration(PLAYERSPEED);

    player.clearActions();
    player.setAnimationSpeed(1 - PLAYERSPEED / 2.5f);
    player.addAction(movement);
    // player.addAction(animationSequence);
    player.addAction(animationRun);

}
项目:flopsydroid    文件:Pipe.java   
public Pipe(TextureRegion region, Stage stage, Droid droid, boolean countPipe, OnScoreListener listener) {
    super(region);

    mAndy = droid;
    mStage = stage;

    mCountPipe = countPipe;
    mListener = listener;

    MoveByAction moveLeft = new MoveByAction();
    moveLeft.setDuration(FlopsyScreen.SPEED);
    moveLeft.setAmountX(-Ground.GROUND_WIDTH);
    addAction(Actions.forever(moveLeft));
}
项目:Escape-of-the-Ninja    文件:GameScreen.java   
public void playDeathAnimation() {
    float x = 50;
    if(playerActor.getDirection()) {
        x = -x;
    }
    MoveByAction moveUp = Actions.moveBy(x, 0, 0.1f + 0.002f*playerActor.getY());
    moveUp.setInterpolation(Interpolation.circleOut);

    MoveByAction moveDown = Actions.moveBy(0,-(playerActor.getY() + playerActor.getWidth()), 0.1f+0.002f*playerActor.getY());
    moveDown.setInterpolation(Interpolation.swingIn);
    Action deathAction = Actions.parallel(moveUp,moveDown);
    playerActor.addAction(deathAction);

}
项目:ead    文件:BaseView.java   
private static MoveByAction move(Actor actor, float targetX, float targetY) {
    return Actions.moveBy(targetX - actor.getX(), targetY - actor.getY(),
            HIDE_TIME, Interpolation.exp5Out);
}