use of com.watabou.pixeldungeon.actors.mobs.npcs.Bee 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);
}
}
Aggregations