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();
}
}
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);
}
}
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();
}
}
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();
}
});
}
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;
}
}
Aggregations