Search in sources :

Example 1 with PosTweener

use of com.watabou.noosa.tweeners.PosTweener in project pixel-dungeon by watabou.

the class CharSprite method move.

public void move(int from, int to) {
    play(run);
    motion = new PosTweener(this, worldToCamera(to), MOVE_INTERVAL);
    motion.listener = this;
    parent.add(motion);
    isMoving = true;
    turnTo(from, to);
    if (visible && Level.water[from] && !ch.flying) {
        GameScene.ripple(from);
    }
    ch.onMotionComplete();
}
Also used : PosTweener(com.watabou.noosa.tweeners.PosTweener)

Example 2 with PosTweener

use of com.watabou.noosa.tweeners.PosTweener in project pixel-dungeon by watabou.

the class MissileSprite method reset.

public void reset(int from, int to, int image, Glowing glowing, Callback listener) {
    revive();
    view(image, glowing);
    this.callback = listener;
    point(DungeonTilemap.tileToWorld(from));
    PointF dest = DungeonTilemap.tileToWorld(to);
    PointF d = PointF.diff(dest, point());
    speed.set(d).normalize().scale(SPEED);
    if (image == 31 || image == 108 || image == 109 || image == 110) {
        angularSpeed = 0;
        angle = 135 - (float) (Math.atan2(d.x, d.y) / 3.1415926 * 180);
    } else {
        angularSpeed = image == 15 || image == 106 ? 1440 : 720;
    }
    PosTweener tweener = new PosTweener(this, dest, d.length() / SPEED);
    tweener.listener = this;
    parent.add(tweener);
}
Also used : PosTweener(com.watabou.noosa.tweeners.PosTweener) PointF(com.watabou.utils.PointF)

Aggregations

PosTweener (com.watabou.noosa.tweeners.PosTweener)2 PointF (com.watabou.utils.PointF)1