Search in sources :

Example 11 with PointF

use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.

the class MagicMissile method reset.

public void reset(int type, PointF from, PointF to, Callback callback) {
    this.callback = callback;
    revive();
    x = from.x;
    y = from.y;
    width = 0;
    height = 0;
    PointF d = PointF.diff(to, from);
    PointF speed = new PointF(d).normalize().scale(SPEED);
    sx = speed.x;
    sy = speed.y;
    time = d.length() / SPEED;
    switch(type) {
        case MAGIC_MISSILE:
        default:
            size(4);
            pour(WhiteParticle.FACTORY, 0.01f);
            break;
        case FROST:
            pour(MagicParticle.FACTORY, 0.01f);
            break;
        case FIRE:
            size(4);
            pour(FlameParticle.FACTORY, 0.01f);
            break;
        case CORROSION:
            size(3);
            pour(CorrosionParticle.MISSILE, 0.01f);
            break;
        case FOLIAGE:
            size(4);
            pour(LeafParticle.GENERAL, 0.01f);
            break;
        case FORCE:
            pour(SlowParticle.FACTORY, 0.01f);
            break;
        case BEACON:
            pour(ForceParticle.FACTORY, 0.01f);
            break;
        case SHADOW:
            size(4);
            pour(ShadowParticle.MISSILE, 0.01f);
            break;
        case RAINBOW:
            size(4);
            pour(RainbowParticle.BURST, 0.01f);
            break;
        case FIRE_CONE:
            size(10);
            pour(FlameParticle.FACTORY, 0.03f);
            break;
        case FOLIAGE_CONE:
            size(10);
            pour(LeafParticle.GENERAL, 0.03f);
            break;
    }
}
Also used : PointF(com.watabou.utils.PointF)

Example 12 with PointF

use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Builder method angleBetweenRooms.

// returns the angle in degrees made by the centerpoints of 2 rooms, with 0 being straight up.
protected static float angleBetweenRooms(Room from, Room to) {
    PointF fromCenter = new PointF((from.left + from.right) / 2f, (from.top + from.bottom) / 2f);
    PointF toCenter = new PointF((to.left + to.right) / 2f, (to.top + to.bottom) / 2f);
    return angleBetweenPoints(fromCenter, toCenter);
}
Also used : PointF(com.watabou.utils.PointF)

Example 13 with PointF

use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.

the class TunnelRoom method getDoorCenter.

// returns a point equidistant from all doors this room has
protected final Point getDoorCenter() {
    PointF doorCenter = new PointF(0, 0);
    for (Door door : connected.values()) {
        doorCenter.x += door.x;
        doorCenter.y += door.y;
    }
    Point c = new Point((int) doorCenter.x / connected.size(), (int) doorCenter.y / connected.size());
    if (Random.Float() < doorCenter.x % 1)
        c.x++;
    if (Random.Float() < doorCenter.y % 1)
        c.y++;
    c.x = (int) GameMath.gate(left + 1, c.x, right - 1);
    c.y = (int) GameMath.gate(top + 1, c.y, bottom - 1);
    return c;
}
Also used : PointF(com.watabou.utils.PointF) Point(com.watabou.utils.Point)

Example 14 with PointF

use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.

the class HallwayRoom method getDoorCenter.

// returns a point equidistant from all doors this room has
protected final Point getDoorCenter() {
    PointF doorCenter = new PointF(0, 0);
    for (Door door : connected.values()) {
        doorCenter.x += door.x;
        doorCenter.y += door.y;
    }
    Point c = new Point((int) doorCenter.x / connected.size(), (int) doorCenter.y / connected.size());
    if (Random.Float() < doorCenter.x % 1)
        c.x++;
    if (Random.Float() < doorCenter.y % 1)
        c.y++;
    c.x = (int) GameMath.gate(left + 2, c.x, right - 2);
    c.y = (int) GameMath.gate(top + 2, c.y, bottom - 2);
    return c;
}
Also used : PointF(com.watabou.utils.PointF) Point(com.watabou.utils.Point)

Example 15 with PointF

use of com.watabou.utils.PointF in project shattered-pixel-dungeon-gdx by 00-Evan.

the class SewerPipeRoom method getDoorCenter.

// returns a point equidistant from all doors this room has
protected final Point getDoorCenter() {
    PointF doorCenter = new PointF(0, 0);
    for (Door door : connected.values()) {
        doorCenter.x += door.x;
        doorCenter.y += door.y;
    }
    Point c = new Point((int) doorCenter.x / connected.size(), (int) doorCenter.y / connected.size());
    if (Random.Float() < doorCenter.x % 1)
        c.x++;
    if (Random.Float() < doorCenter.y % 1)
        c.y++;
    c.x = (int) GameMath.gate(left + 2, c.x, right - 2);
    c.y = (int) GameMath.gate(top + 2, c.y, bottom - 2);
    return c;
}
Also used : PointF(com.watabou.utils.PointF) Point(com.watabou.utils.Point)

Aggregations

PointF (com.watabou.utils.PointF)56 Emitter (com.watabou.noosa.particles.Emitter)9 ScaleTweener (com.watabou.noosa.tweeners.ScaleTweener)5 Point (com.watabou.utils.Point)5 RectF (android.graphics.RectF)3 PosTweener (com.watabou.noosa.tweeners.PosTweener)3 ArrayList (java.util.ArrayList)2 Char (com.shatteredpixel.shatteredpixeldungeon.actors.Char)1 Lightning (com.shatteredpixel.shatteredpixeldungeon.effects.Lightning)1 Heap (com.shatteredpixel.shatteredpixeldungeon.items.Heap)1 Crossbow (com.shatteredpixel.shatteredpixeldungeon.items.weapon.melee.Crossbow)1 Dart (com.shatteredpixel.shatteredpixeldungeon.items.weapon.missiles.darts.Dart)1 Room (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.Room)1 ConnectionRoom (com.shatteredpixel.shatteredpixeldungeon.levels.rooms.connection.ConnectionRoom)1 CharSprite (com.shatteredpixel.shatteredpixeldungeon.sprites.CharSprite)1 NoosaInputProcessor (com.watabou.input.NoosaInputProcessor)1 ColorBlock (com.watabou.noosa.ColorBlock)1 Image (com.watabou.noosa.Image)1 TextureFilm (com.watabou.noosa.TextureFilm)1 TouchArea (com.watabou.noosa.TouchArea)1