Search in sources :

Example 11 with AlphaTweener

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

the class Heap method open.

public void open(Hero hero) {
    switch(type) {
        case MIMIC:
            if (Mimic.spawnAt(pos, items) != null) {
                GLog.n(TXT_MIMIC);
                destroy();
            } else {
                type = Type.CHEST;
            }
            break;
        case TOMB:
            Wraith.spawnAround(hero.pos);
            break;
        case SKELETON:
            CellEmitter.center(pos).start(Speck.factory(Speck.RATTLE), 0.1f, 3);
            for (Item item : items) {
                if (item.cursed) {
                    if (Wraith.spawnAt(pos) == null) {
                        hero.sprite.emitter().burst(ShadowParticle.CURSE, 6);
                        hero.damage(hero.HP / 2, this);
                    }
                    Sample.INSTANCE.play(Assets.SND_CURSED);
                    break;
                }
            }
            break;
        case HIDDEN:
            sprite.alpha(0);
            sprite.parent.add(new AlphaTweener(sprite, 1, FADE_TIME));
            break;
        default:
    }
    if (type != Type.MIMIC) {
        type = Type.HEAP;
        sprite.link();
        sprite.drop();
    }
}
Also used : AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener)

Example 12 with AlphaTweener

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

the class Honeypot method shatter.

private void shatter(int pos) {
    Sample.INSTANCE.play(Assets.SND_SHATTER);
    if (Dungeon.visible[pos]) {
        Splash.at(pos, 0xffd500, 5);
    }
    int newPos = pos;
    if (Actor.findChar(pos) != null) {
        ArrayList<Integer> candidates = new ArrayList<Integer>();
        boolean[] passable = Level.passable;
        for (int n : Level.NEIGHBOURS4) {
            int c = pos + n;
            if (passable[c] && Actor.findChar(c) == null) {
                candidates.add(c);
            }
        }
        newPos = candidates.size() > 0 ? Random.element(candidates) : -1;
    }
    if (newPos != -1) {
        Bee bee = new Bee();
        bee.spawn(Dungeon.depth);
        bee.HP = bee.HT;
        bee.pos = newPos;
        GameScene.add(bee);
        Actor.addDelayed(new Pushing(bee, pos, newPos), -1);
        bee.sprite.alpha(0);
        bee.sprite.parent.add(new AlphaTweener(bee.sprite, 1, 0.15f));
        Sample.INSTANCE.play(Assets.SND_BEE);
    }
}
Also used : Bee(com.watabou.pixeldungeon.actors.mobs.npcs.Bee) Pushing(com.watabou.pixeldungeon.effects.Pushing) ArrayList(java.util.ArrayList) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener)

Example 13 with AlphaTweener

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

the class CityBossLevel method press.

@Override
public void press(int cell, Char hero) {
    super.press(cell, hero);
    if (!enteredArena && outsideEntraceRoom(cell) && hero == Dungeon.hero) {
        enteredArena = true;
        Mob boss = Bestiary.mob(Dungeon.depth);
        boss.state = boss.HUNTING;
        int count = 0;
        do {
            boss.pos = Random.Int(LENGTH);
        } while (!passable[boss.pos] || !outsideEntraceRoom(boss.pos) || (Dungeon.visible[boss.pos] && count++ < 20));
        GameScene.add(boss);
        if (Dungeon.visible[boss.pos]) {
            boss.notice();
            boss.sprite.alpha(0);
            boss.sprite.parent.add(new AlphaTweener(boss.sprite, 1, 0.1f));
        }
        set(arenaDoor, Terrain.LOCKED_DOOR);
        GameScene.updateMap(arenaDoor);
        Dungeon.observe();
    }
}
Also used : Mob(com.watabou.pixeldungeon.actors.mobs.Mob) AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener)

Example 14 with AlphaTweener

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

the class DungeonTilemap method discover.

public void discover(int pos, int oldValue) {
    final Image tile = tile(oldValue);
    tile.point(tileToWorld(pos));
    // For bright mode
    tile.rm = tile.gm = tile.bm = rm;
    tile.ra = tile.ga = tile.ba = ra;
    parent.add(tile);
    parent.add(new AlphaTweener(tile, 0, 0.6f) {

        protected void onComplete() {
            tile.killAndErase();
            killAndErase();
        }
    });
}
Also used : AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener) Image(com.watabou.noosa.Image)

Example 15 with AlphaTweener

use of com.watabou.noosa.tweeners.AlphaTweener in project shattered-pixel-dungeon-gdx by 00-Evan.

the class Wraith method spawnAt.

public static Wraith spawnAt(int pos) {
    if (Dungeon.level.passable[pos] && Actor.findChar(pos) == null) {
        Wraith w = new Wraith();
        w.adjustStats(Dungeon.depth);
        w.pos = pos;
        w.state = w.HUNTING;
        GameScene.add(w, SPAWN_DELAY);
        w.sprite.alpha(0);
        w.sprite.parent.add(new AlphaTweener(w.sprite, 1, 0.5f));
        w.sprite.emitter().burst(ShadowParticle.CURSE, 5);
        return w;
    } else {
        return null;
    }
}
Also used : AlphaTweener(com.watabou.noosa.tweeners.AlphaTweener)

Aggregations

AlphaTweener (com.watabou.noosa.tweeners.AlphaTweener)20 Image (com.watabou.noosa.Image)6 ArrayList (java.util.ArrayList)3 Buff (com.watabou.pixeldungeon.actors.buffs.Buff)2 Mob (com.watabou.pixeldungeon.actors.mobs.Mob)2 SparseArray (com.watabou.utils.SparseArray)2 Buff (com.shatteredpixel.shatteredpixeldungeon.actors.buffs.Buff)1 Bee (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Bee)1 King (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.King)1 Mob (com.shatteredpixel.shatteredpixeldungeon.actors.mobs.Mob)1 Pushing (com.shatteredpixel.shatteredpixeldungeon.effects.Pushing)1 TorchHalo (com.shatteredpixel.shatteredpixeldungeon.effects.TorchHalo)1 WndInfoBuff (com.shatteredpixel.shatteredpixeldungeon.windows.WndInfoBuff)1 Bee (com.watabou.pixeldungeon.actors.mobs.npcs.Bee)1 Pushing (com.watabou.pixeldungeon.effects.Pushing)1 Level (com.watabou.pixeldungeon.levels.Level)1 Point (com.watabou.utils.Point)1