use of com.watabou.noosa.tweeners.AlphaTweener in project shattered-pixel-dungeon-gdx by 00-Evan.
the class Honeypot method shatter.
public Item shatter(Char owner, int pos) {
if (Dungeon.level.heroFOV[pos]) {
Sample.INSTANCE.play(Assets.SND_SHATTER);
Splash.at(pos, 0xffd500, 5);
}
int newPos = pos;
if (Actor.findChar(pos) != null) {
ArrayList<Integer> candidates = new ArrayList<Integer>();
boolean[] passable = Dungeon.level.passable;
for (int n : PathFinder.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.setPotInfo(pos, owner);
bee.HP = bee.HT;
bee.pos = newPos;
GameScene.add(bee);
Actor.addDelayed(new Pushing(bee, pos, newPos), -1f);
bee.sprite.alpha(0);
bee.sprite.parent.add(new AlphaTweener(bee.sprite, 1, 0.15f));
Sample.INSTANCE.play(Assets.SND_BEE);
return new ShatteredPot().setBee(bee);
} else {
return this;
}
}
use of com.watabou.noosa.tweeners.AlphaTweener in project shattered-pixel-dungeon-gdx by 00-Evan.
the class BuffIndicator method layout.
@Override
protected void layout() {
ArrayList<Buff> newBuffs = new ArrayList<>();
for (Buff buff : ch.buffs()) {
if (buff.icon() != NONE) {
newBuffs.add(buff);
}
}
// remove any icons no longer present
for (Buff buff : buffIcons.keySet().toArray(new Buff[0])) {
if (!newBuffs.contains(buff)) {
Image icon = buffIcons.get(buff).icon;
icon.origin.set(SIZE / 2);
add(icon);
add(new AlphaTweener(icon, 0, 0.6f) {
@Override
protected void updateValues(float progress) {
super.updateValues(progress);
image.scale.set(1 + 5 * progress);
}
@Override
protected void onComplete() {
image.killAndErase();
}
});
buffIcons.get(buff).destroy();
remove(buffIcons.get(buff));
buffIcons.remove(buff);
}
}
// add new icons
for (Buff buff : newBuffs) {
if (!buffIcons.containsKey(buff)) {
BuffIcon icon = new BuffIcon(buff);
add(icon);
buffIcons.put(buff, icon);
}
}
// layout
int pos = 0;
for (BuffIcon icon : buffIcons.values()) {
icon.updateIcon();
icon.setRect(x + pos * (SIZE + 2), y, 9, 12);
pos++;
}
}
use of com.watabou.noosa.tweeners.AlphaTweener in project pixel-dungeon-remix by NYRDS.
the class BuffIndicator method layout.
@Override
protected void layout() {
clear();
SparseArray<Image> newIcons = new SparseArray<>();
for (Buff buff : ch.buffs()) {
int icon = buff.icon();
if (icon != NONE) {
Image img = new Image(texture);
img.frame(film.get(icon));
img.x = x + members.size() * (SIZE + 2);
img.y = y;
add(img);
newIcons.put(icon, img);
}
}
for (Integer key : icons.keyArray()) {
if (newIcons.get(key) == null) {
Image icon = icons.get(key);
icon.origin.set(SIZE / 2);
add(icon);
add(new AlphaTweener(icon, 0, 0.6f) {
@Override
protected void updateValues(float progress) {
super.updateValues(progress);
image.Scale().set(1 + 5 * progress);
}
});
}
}
icons = newIcons;
}
use of com.watabou.noosa.tweeners.AlphaTweener in project pixel-dungeon-remix by NYRDS.
the class ShadowLord method twistLevel.
private void twistLevel() {
if (!isAlive()) {
return;
}
Level level = Dungeon.level;
if (!levelCreated) {
Tools.makeEmptyLevel(level);
Tools.buildShadowLordMaze(level, 6);
levelCreated = true;
}
int cell = level.getRandomTerrainCell(Terrain.PEDESTAL);
if (level.cellValid(cell)) {
if (Actor.findChar(cell) == null) {
Mob mob = Crystal.makeShadowLordCrystal();
mob.setPos(cell);
level.spawnMob(mob);
mob.getSprite().alpha(0);
mob.getSprite().getParent().add(new AlphaTweener(mob.getSprite(), 1, 0.4f));
mob.getSprite().emitter().start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
int x, y;
x = level.cellX(cell);
y = level.cellY(cell);
level.fillAreaWith(Darkness.class, x - 2, y - 2, 5, 5, 1);
} else {
damage(ht() / 9, this);
}
}
}
use of com.watabou.noosa.tweeners.AlphaTweener in project pixel-dungeon-remix by NYRDS.
the class WandOfBlink method appear.
public static void appear(Char ch, int pos) {
ch.getSprite().interruptMotion();
ch.move(pos);
ch.getSprite().place(pos);
if (ch.invisible == 0) {
ch.getSprite().alpha(0);
ch.getSprite().getParent().add(new AlphaTweener(ch.getSprite(), 1, 0.4f));
}
ch.getSprite().emitter().start(Speck.factory(Speck.LIGHT), 0.2f, 3);
Sample.INSTANCE.play(Assets.SND_TELEPORT);
}
Aggregations