use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.
the class MirrorImage method sprite.
@Override
public CharSprite sprite() {
CharSprite s = super.sprite();
((MirrorSprite) s).updateArmor(tier);
return s;
}
use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.
the class HealthIndicator method update.
@Override
public void update() {
super.update();
if (target != null && target.isAlive() && target.sprite.visible) {
CharSprite sprite = target.sprite;
bg.scale.x = sprite.width;
level.scale.x = sprite.width * target.HP / target.HT;
bg.x = level.x = sprite.x;
bg.y = level.y = sprite.y - HEIGHT - 1;
visible = true;
} else {
visible = false;
}
}
use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon-remix by NYRDS.
the class Mob method sprite.
public CharSprite sprite() {
try {
{
String descName = "spritesDesc/" + getMobClassName() + ".json";
if (ModdingMode.isResourceExist(descName) || ModdingMode.isAssetExist(descName)) {
return new MobSpriteDef(descName, getKind());
}
}
if (spriteClass instanceof Class) {
CharSprite sprite = (CharSprite) ((Class<?>) spriteClass).newInstance();
sprite.selectKind(getKind());
return sprite;
}
if (spriteClass instanceof String) {
return new MobSpriteDef((String) spriteClass, getKind());
}
throw new TrackedRuntimeException(String.format("sprite creation failed - mob class %s", getMobClassName()));
} catch (Exception e) {
throw new TrackedRuntimeException(e);
}
}
use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.
the class Item method use.
public void use() {
if (level > 0 && !isBroken()) {
int threshold = (int) (maxDurability() * DURABILITY_WARNING_LEVEL);
if (durability-- >= threshold && threshold > durability && levelKnown) {
GLog.w(TXT_GONNA_BREAK, name());
}
if (isBroken()) {
getBroken();
if (levelKnown) {
GLog.n(TXT_BROKEN, name());
Dungeon.hero.interrupt();
CharSprite sprite = Dungeon.hero.sprite;
PointF point = sprite.center().offset(0, -16);
if (this instanceof Weapon) {
sprite.parent.add(Degradation.weapon(point));
} else if (this instanceof Armor) {
sprite.parent.add(Degradation.armor(point));
} else if (this instanceof Ring) {
sprite.parent.add(Degradation.ring(point));
} else if (this instanceof Wand) {
sprite.parent.add(Degradation.wand(point));
}
Sample.INSTANCE.play(Assets.SND_DEGRADE);
}
}
}
}
use of com.watabou.pixeldungeon.sprites.CharSprite in project pixel-dungeon by watabou.
the class GameScene method addMobSprite.
private void addMobSprite(Mob mob) {
CharSprite sprite = mob.sprite();
sprite.visible = Dungeon.visible[mob.pos];
mobs.add(sprite);
sprite.link(mob);
}
Aggregations